How to control XAResource in inbound jca resource adapter for conversational transaction?

风流意气都作罢 提交于 2020-01-17 04:22:05

问题


Im writing an inbound resource adapter with JCA for a legacy EIS.

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.

Is there any way that I can manage the lifecycle myself from within the RA?


回答1:


Apparantly I can answer my question myself.

When ResourceAdapter.start() is called, the provided BootstrapContext contains a XATerminator. This terminator exposes the lifecycle methods.

see

http://docs.oracle.com/javaee/6/api/javax/resource/spi/ResourceAdapter.html http://docs.oracle.com/javaee/6/api/javax/resource/spi/BootstrapContext.html

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)

see chapter 15 Transaction inflow of the jca 1.6 specification.



来源:https://stackoverflow.com/questions/28881889/how-to-control-xaresource-in-inbound-jca-resource-adapter-for-conversational-tra

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!