Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

140
Views
JmsTemplate batch issue

my current use case is in my listener it will:

  1. Consume an event(let's call it original event) from queue, this event includes list of replay events(let's call it sub events).
  2. Produce those replay events (sub events) in a batch to other queue.
  3. Update Cassandra.

I can produce all the replay events based on what Gary mention, and rollback all the replay events if any exceptions happen during produce.

Use one of the execute methods with a ProducerCallback...

SessionCallback and ProducerCallback

Then, in your ProducerCallback.doInJms() method...

Use the producer to send multiple messages. When the callback exits, the transaction will be committed.

However, if there are any exception happen in step 3 we can only rollback the original event but not those replay events, since in step 2 we already committed those replay events after the callback exits and those replay events already in another queue and cannot be rollback.

Does someone has any better idea about how we can rollback everything if step 3 has exception?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You have to do everything within the same session; consume, produce..., cassandra.

All inside doInJms()...

  • session.createConsumer()

try {

  • consumer.receive()
  • producer send() ...
  • cassandra update

finally {

  • consumer.close()

}

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!