MSMQ Transaction with COM (python)?

1.9k views Asked by At

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?

1

There are 1 answers

1
John Breakwell On

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