I’m currently working on jms message using the default broker from glassfish. Example I have a queueA.
queueA, will receive 2 types of response:
1.) normal response – meaning the service replies immediately without any problem,
2.) expired response – service replies after 2days.
On the queueA, I have a jms receiver that times out after 5mins, so after that no one will pickup the message and it will timeout after 30s. The question is, can I throw an event when this event happens so that I can handle the delayed response?
Thanks,
czetsuya
Unfortunately, I found out that there is no message expiration action that will be thrown by glassfish when this event occurs. My work around is to use 2 queues synchronous and asynchronous, that will be read synchronously, if the message is already gone then write to the asynchronous queue.
SenderA writes to AsynchronousQueueA
SenderA starts reading SynchronousQueueResponseS (for n seconds)
ReceiverA receives message from SenderA to AsynchronousQueueA
ReceiverA writes a reply to SynchronousQueueResponseS
if failed then write a reply to AsynchronousQueueResponseA.
Take note that the thread listening to SynchronousQueueResponseS will expire in n seconds, if it does the reply will be written to AsynchronousQueueResponseA. This is a solution for a queue expiration event listener.