java - Threads and Jms Transaction -
I am stuck in the following scenario. Please give me advice on this
There is an inbound queue running a main thread (we are not using the JMS listener) and selecting a message from the queue and processing the message and again Start another sub thread to process.
The problem now is how can I handle transactions in the main thread and sub thread. Which means that when I process the message in the main thread, there is some data base access error, so I want to rollback back the message in the inbound queue. And if there is a single failure in the sub thread that was created by the main thread, then the recovered message should rollback in the inbound queue.
I have gone through the context of JMS Spring, but these transactions only JM listeners
How can I apply the concept of transaction in my scenario
< P> Please advise me, if you have any sample program please share it with me It would be better to understand your concepts.
I think you are in a difficult area here. Due to having two threads working in the same transaction, I feel full of race conditions and other dangers - in fact, I do not even know that this is possible. The JETA Transaction API, which I am familiar with, uses one-to-one mapping for transactions from threads.
Why not by taking messages from each of you queues and all the work. There is no need to create a new thread after after taking the message. You gain equality and greater simplicity.
Then you find that you have effectively rebuilt the standard Java approach, so why not use an MDB?
Comments
Post a Comment