MDB pulling messages using the same Timestamp for requeu and exception queue
posted 9 years ago
I am writing an MDB that pulls messages from a Queue i.e. QueueA and after validation saves it in a Database. Now if the validation fails I want to queue it in a different Queue i.e. QueueB and if it's a serious error then I want to requeue the message to Exception Queue i.e.QueueC.
How can read the Timestamp when I pull a message from QueueA and if I am requeuing the message want to use the same Timestamp i.e. I pull a message read the Timestamp saves it in a variable and if validation fails want to use the same Timestamp in the Header when re-queuing. Same message can be re-queued several times but I always wants to keep the original Timestamp i.e. the one that was in QueueA. How can I achieve it.
Also when requeuing the message to Exception Queue wants to populate the error in JMS Header where exactly that information goes. Any help is appreciated.
The reason wants to get the Timestamp is that the same message can be queued several times in QueueA and just want to process the latest message only. Now eventually all the information goes to Database so wants to have the latest data in Database. So in case all the messages goes to QueueB and when processing them again I want to just process the message with latest timestamp only, I am trying to have a temporary table where when a message is originally pulled I save some information that is unique for any record I am trying to process.
MB<br />Sun Certified Programmer for Java2 Platform