• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Query regarding Database commit and Queue Commit

Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Let me first give a brief introduction of the business scenario -

I am using JMS Queues and I have a Java application which listens on this queue constantly. Wheneever, there is a message on this queue, it is picked by this Java application and a stored procedure is called internally and the data from the message is stored in the database tables.In an ideal scenario,the message would be succesfully parsed and the data would be succesfully commited into the database and then the Queue would be committed.

The problem with this approach
Imagine now, that due to some reasons, the database commit was succesful but the Queue commit fails. In this scenario, the same message would be picked by the java application listening on the Queue and all the cycle repeats again which is not desirable at all.

So, I am looking for a solution wherein either both the database and the Queue commit or both Rollback.

Thanks in advance !!!

Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not,as your first step when receiving a message, check whether a duplicate exists in the database; if so, disregard the incoming message.

You should be able to do a simple select based on the criteria of the message; I assume you're using some form of compound key based on message properties.

This is probably simpler than trying to get a transactional rollback system working.

Failing that, I believe there are several distributed transactional systems for JMS. What JMS Server are you using?

Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic