Reputation: 505
my current use case is in my listener it will:
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?
Upvotes: 0
Views: 724
Reputation: 174564
You have to do everything within the same session; consume, produce..., cassandra.
All inside doInJms()
...
try {
finally {
}
Upvotes: 2