Enlisting IBM Websphere MQ Series in COM+ transaction
-
Hi guys, I have some serious problems with com+ and the ibm mq series. I have a windows service with a com+ defined class (inherits ServicedComponent, has [Transaction(TransactionOption.RequiresNew)] and [AutoComplete(true)] on the method. The problem is that the mq series part never rolls back in case of any errors, the other transactions works perfectly fine. When it comes to the mq connection, I have set up the enviroment to use server- bindings (a requirement for using transactions)
MQEnvironment.properties[MQC.TRANSPORT_PROPERTY] = MQC.TRANSPORT_MQSERIES_BINDINGS;
and the connection / send looks like this (stripped):
queueManager = new MQQueueManager(queueManagerName, channel, host);
queueManager.Connect();
...
sendOptions = new MQPutMessageOptions();
sendOptions.Options += MQC.MQRO_NEW_MSG_ID + MQC.MQRO_COPY_MSG_ID_TO_CORREL_ID;
sendOptions.Options += MQC.MQGMO_SYNCPOINT;
...
queue = queueManager.AccessQueue(queueName, MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING);
queue.Put(msg, sendOptions);
queue.Close();Do I have to do anything in perticular in the transaction-based method for this to work? Scaled down, it looks lite this:
[AutoComplete(true)]
function void DoWork()
{
try
{
send_message_on_mqqueue();
do_some_db_work();
ContextUtil.SetComplete();
}
catch (Exception)
{
ContextUtil.SetAbort();
}
}Any help, thoughts or suggestions are appreciated!