问题描述
我正在使用JCA为旧版EIS编写入站资源适配器.
Im writing an inbound resource adapter with JCA for a legacy EIS.
EIS不支持XA事务.但是,这些消息构成了一个对话,其中存在多个消息.每条消息都会导致将由消息端点执行的操作.
The EIS does not support XA transactions. The messages however form a conversation that exist of multiple messages. Each message leads to an action that will be executed by the message endpoint.
在对话结束时,将收到一个提交/回退消息.届时,所有操作都应提交或回退.
At the end of the conversation, a commit/rollback message will be received. At that moment all actions should be either committed or rolled back.
我可以通过RA自己管理生命周期的任何方式吗?
Is there any way that I can manage the lifecycle myself from within the RA?
推荐答案
我显然可以自己回答问题.
Apparantly I can answer my question myself.
调用ResourceAdapter.start()时,提供的BootstrapContext包含XATerminator.该终结器公开了生命周期方法.
When ResourceAdapter.start() is called, the provided BootstrapContext contains a XATerminator. This terminator exposes the lifecycle methods.
请参见
http://docs.oracle.com/javaee/6/api/javax/resource/spi/ResourceAdapter.html http://docs.oracle.com/javaee/6 /api/javax/resource/spi/BootstrapContext.html
准备执行工作时,生成一个XID,在ExecutionContext上进行设置,然后将该执行上下文传递给工作经理. (您可能需要实现自定义XID实现)
When ready to execute work, generate a XID, set it on the ExecutionContext and pass that execution context to the workmanager. (you probably need to implement a custom XID implementation)
请参阅jca 1.6规范的 15个事务流入一章.
see chapter 15 Transaction inflow of the jca 1.6 specification.
这篇关于如何控制入站jca资源适配器中的XAResource以进行会话事务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!