如何从WebSphere MQ在.NET做交易得到什么? [英] How to do a transactional get from Websphere MQ in .NET?
问题描述
我正在写从外部WebSphere MQ队列接收消息,并将它们放在一个内部MSMQ队列的客户端。客户端将使用MQ客户端或preferably,是纯粹的管理(MQC.TRANSPORT_MQSERIES_MANAGED)。
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).
根据的<一个href="http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=/com.ibm.mq.csqzav.doc/un10450_.htm"相对从IBM =nofollow的>的例子,我有一个版本运行起来,可以做一个简单的IBM.WMQ.MQQueue.Get(...)。怎么可以这样操作在事务内完成?我在考虑使用非XA事务。
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.
推荐答案
在WMQ单阶段提交被越来越消息时将消息或MQC.MQGMO_SYNCPOINT标志在使用MQC.MQPMO_SYNCPOINT标志启用。要完成的工作单位,调用队列管理器对象的提交或回退的方法。
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.
参考:在回退和提交的的 MQQueueManager 手册中的部分。
Reference: the Backout and Commit methods in the MQQueueManager section in the manual.
只要你使用的是管理code,你被限制在1阶段提交。如果在绑定模式下使用非托管code(使用共享内存跟一个本地WMQ QMGR),可以使用XA。在这种情况下,你需要使用Begin方法。
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.
这篇关于如何从WebSphere MQ在.NET做交易得到什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!