Announcement Announcement Module
No announcement yet.
XA transaction commit control Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • XA transaction commit control

    I need the ability to:

    1) pickup a message from a queue
    2) write some data to a database for that message
    3) commit the XA transaction
    4) process the data from the queue message (time intensive)

    Repeat. (only process a message at a time, and only part of that should be in an XA)

    I think this can be represented in code as such:

    public void onMessage(Message message, Session session) {
    		try {
    			String uuid = message.getStringProperty("id");
    		} catch (JMSException ex) {
    			throw new RuntimeException(ex);
    I need to make sure that the message being pulled from the queue, and the database update are part of a single(global) transaction. However, I do NOT want the heavyProcessing(uuid) method to run in the transaction as well. It can take up to 2 minutes to run, and I don't want any unnecessary locking to occur on the database.

    Using declarative transactions in spring has been really helpful until this point. So is there a way to manually commit the XA transaction (so the resources can be released) before I move on the to the time intensive processing? I don't want the next message to be picked up until the heavy processing is complete.

    If there is another way to accomplish this, please let me know. I am very much stuck, and haven't been able to find much help in this area. Thanks.