简体   繁体   中英

MSMQ Transaction with COM (python)?

I'm attempting to use MSMQ from Python using the win32com library, similar to this example . 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.

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.
Just set the transaction parameter to MQ_SINGLE_MESSAGE when you call Send().

Cheers
John Breakwell

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM