• 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 ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

What transaction Attribute to use

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all

We have a requirement where a backend job starts and calls the SSB via a webservice and places the messages in the queue. This backend job would run every 5 minutes and we have to make sure that the same message is not picked up twice.

The SSB which puts the message into the queue has a transaction attribute of Required.
To accomplish the above we are planning to set a flag in the database against each message after the message is put in the arraylist within the SSB.

Since lot of XML parsing is involved internally, the time taken to process 1000 messages is 20 minutes. So, here are my doubts. To accomplish the above

1. Since the entire process takes 20 minutes and the backend job runs every 5 minutes there is a high probability that the same record could be picked up.
2. So, Can I define one more method in SSB and do a updation in the database by setting the flag against each messages that was selected? and make this method not a part of the actual transaction by setting the transaction attribute to be NotSupported.

Or is there a different way to do do.

Please any suggestions is appreciated.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, so if the update of the database of all the records selected is not part of the transaction, and the first method which is the 20 minute process fails and rolls back, you would need to change those records back to not being selected.

But if you keep that second method in the first's transaction, then other clients won't see that you have selected them.

I would definitely look at the process that takes 20 minutes to reduce that time, or change your others interval to be over that time. But later if your system is bogged down, that process might take more than 20 minutes to complete and then your interval is too small again.

I definitely think the approach to the process and what needs to be done is in order. I just can't think of a great solution for you at the top of my head right now. Sorry.

Mark
 
and POOF! You're gone! But look, this tiny ad is still here:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic