How to do a transactional get from Websphere MQ in .NET?

て烟熏妆下的殇ゞ 提交于 2019-12-03 21:27:28

问题


I’m writing a client that receives messages from an external Websphere MQ Queue and puts them on an internal MSMQ Queue. The client will use MQ Client or, preferably, be purely managed (MQC.TRANSPORT_MQSERIES_MANAGED).

Based on an example from IBM, I have a version up and running that can do a simple IBM.WMQ.MQQueue.Get(…). How can this operation be done within a transaction? I'm thinking of using non-XA transactions.


回答1:


The WMQ Single-Phase Commit is enabled by using the MQC.MQPMO_SYNCPOINT flag when putting messages or the MQC.MQGMO_SYNCPOINT flag when getting messages. To complete the unit of work, call the queue manager object's Commit or Backout method.

Reference: the Backout and Commit methods in the MQQueueManager section in the manual.

As long as you are using managed code you are limited to 1-phase commit. If using unmanaged code in bindings mode (using shared memory to talk to a local WMQ QMgr) you can use XA. In that case you'd need to use the Begin method.



来源:https://stackoverflow.com/questions/3084849/how-to-do-a-transactional-get-from-websphere-mq-in-net

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