[英]MSMQ Transaction with COM (python)?
I'm attempting to use MSMQ from Python using the win32com library, similar to this example . 我正在尝试使用win32com库从Python中使用MSMQ,类似于此示例 。 I'm able to put messages onto the queue, but in this case it's a transactional queue, so I need to create a transaction around the message send.
我能够将消息放入队列,但在这种情况下,它是一个事务性队列,所以我需要围绕消息发送创建一个事务。 Basically I'm attempting to do this VB example in python using COM.
基本上我正在尝试使用COM在python中执行此VB示例 。
I can't figure out how to get the transaction to happen: 我无法弄清楚如何让事务发生:
import win32com.client
transaction=win32com.client.Dispatch("MSMQ.MSMQTransaction")
transaction.Begin()
gives: 得到:
AttributeError: MSMQ.MSMQTransaction.Begin
How do I begin the transaction? 我该如何开始交易? Am I on the right track?
我是在正确的轨道上吗?
You don't need an MSMQtransaction object to send a transactional message to a transactional queue. 您不需要MSMQtransaction对象将事务性消息发送到事务性队列。
Just set the transaction parameter to MQ_SINGLE_MESSAGE when you call Send(). 调用Send()时,只需将事务参数设置为MQ_SINGLE_MESSAGE即可。
Cheers 干杯
John Breakwell 约翰休斯威尔
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.