Question & Answer
Question
Why does JMS commit failure does not roll back parent transaction in IBM Sterling Order Management
Cause
If there is any error during JMS commit, the parent transaction/service does not roll back.
Answer
Parent service calls a child service, which has a JMS sender component to write message to a JMS queue. JMS sender has the flag Commit of this message depends on parent transaction enabled, now If there is any error during JMS commit, the parent transaction/service does not roll back.
Sterling OMS does not support Two phase commit, and hence DB commit(Sterling transaction commit) and JMS commit will happen independently. The scenario in question can happen if DB commit happens first and then JMS commit happens. If any error occurs during JMS commit, then only JMS message send/put will fail but the parent transaction will not rollback as it has already committed.
If it is desired that JMS commit happens immediately, then flag Commit of this message depends on parent transaction should be unchecked. This would mean that JMS commit will be done at the time of JMS send itself. After this, the service execution will continue further. However, if service gets rolled back later due to some exception, even then the JMS message will remain in the JMS queue. This may cause duplicate message into the JMS queue when the service is run again.
With the flag Commit of this message depends on parent transaction enabled, the default order of commit at the end of flow, is such that database commit happens first followed by JMS sender commit. If there is a need to change the order of commit for across JVM, then the below property in customer_overrides.properties can be used.
----------------------------
yfs.enable.db.check.before.jms.commit=Y
----------------------------
With this property set to Y, JMS sender is committed first followed by database. Please refer product documentation for more details about this property.
Which order of commit to use, should be based on whether the business functionality is better off dealing with a 'lost message in the JMS queue' or it s better off dealing with 'a duplicate message in the jms queue'.
Note- The above mentioned customer overrides property should be used with caution. Please refer product documentation for more details about it.
Was this topic helpful?
Document Information
Modified date:
16 June 2018
UID
swg22007495