Transaction JMS Trigger

I am trying to set up a JMS trigger that pulls messages from MQSeries. I have set up a transactional queue connection factory (Support XA transactions checked) within my .bindings and set up the connection alias to use XA_TRANSACTION.

In my test flow service that the trigger kicks off runs, I invoke pub.art.transaction:startTransaction at the start, enter the loop to process the incoming JMSMessages, issue a ServiceException manually to make it follow the error sequence which in turn invokes pub.art.transaction:rollbackTransaction.

My test flow service goes thru the steps mentioned above, however the message does not remain on the MQ queue.

I am needing any advice in how to make transactional JMS triggers work properly for a project I’m working on. We are wanting to make use of commit/rollback with MQ rather than use pub/sub on webMethods broker.

When you said manually above are you trying to debug (step/trace thru) the flow which has start/commit/rollback calls and getting the error?

Please clarify:

HTH,
RMG

No, I’m starting the JMS trigger and letting it run on its own. On the ServiceException I should have said I’m invoking it to force an exception so that my service falls into the catch for Failure Sequence step and performs the rollback. The message does not rollback and the JMS trigger does not suspend (I have Suspend and Recover set on the trigger) and also Suspend on error set to True on the trigger.

I believe you have to use LOCAL_TRANSACTION on the adapter connection to make it work assuming you have implemented transactional logic (transactionName) same across start/commit/rollback sequentially:

HTH,
RMG

Actually I did use LOCAL TRANSACTION on the connection alias at first. When setting up the queue connection factory I noticed it has an option to check for XA…do you know if that has to be checked or shouldn’t be checked? Because I saw that I tried creating it with it checked and changed my alias to XA to see if that would work, but no luck.

Have XA not checked and try the testing again…not sure what could be wrong your setup as far I can think of.

HTH,
RMG

Ok, I changed my queue connection factory to not have XA checked when defining my .binding objects. Also made sure my queue was defined with persistence. Also set the QCF to Syncpoint all gets to true.

Created my connection alias setting it to local transaction & pointing to the QCF from jndi .bindings file created above (am connection to MQSeries as the provider).

Created my JMS trigger pointing to the trans conn alias above

The flow service the JMS trigger calls performs (outside of the try/catch) pub.art.transaction:startTransaction. Then within the try sequence it will call pub.art.transaction:commitTransaction and within the failure catch sequence it will call pub.art.transaction:rollbackTransaction.

I throw a ServiceException in the try sequence to force a failure, however my message does not remain on the MQ queue.

Has anyone been able to set up transactional JMS triggering successfully? And does anyone have any idea what I may be missing in my configurations to make this work?

Are sure the error trapped in the catch block and thus rollback the transaction (to the same transactionName from start) and what is the last step in your catch? Do you have Exit step ON Failure as a last step in the catch)–? Also please check this having some debug log inside your catch block.

What is the end result you want to see transaction stay in queue?

HTH,
RMG

XA is for a coordinated distributed transaction so you don’t need that for this. Since you configured the connection to be a transaction connection and local you also don’t need an explict start/commit/rollback, local transaction will handle that for you. Once you have caught the error, the service needs to exit with a failure signal and that should roll back your transaction.

1 Like

Thank you so much, removing the explicit calls to start/commit/rollback and adding the Exit with a failure signal did it!!!

Glad it worked out fine: :smiley: