Ravish Mody

All the people who have worked with JMS must have come across messages getting in pending state or message becoming a poison message due to which lot for issue are been faced like messages are not been picked up, outofmemory issue and lots more.

To reduce these kind of issues we can create an error queue on weblogic server. Now people who does not have any idea or much idea of what is an error queue this post would be a very useful you guys. So first thing first lets talk about

– What is a poison message?
– What is an Error queue?

What is a Poison Message?

Poison Message

Poison Message

Any message which is not able to get delivered to the consumer/listener due to which other messages in the queue gets stuck, then that message is called a poison message.

What is an Error Queue?

Error Queue

Error Queue

It is a queue which comes into the picture when any messages are not able get delivered to the consumer/listener are sent to the error queue and would again send it back to the normal queue so that it can try to resend the same message again.

Advantage of Error Queue

  • No poison messages are produced. So that other messages in the normal queue get delivered properly.
  • Make sure we can try to deliver the poison message again.
  • Can save us from outofmemory issue, pending messages etc.

Steps to Configure Error Queue:

1.  You have to follow steps from Step-1 to Step-5 from the post Basic JMS Demo using WebLogic Queue.

2.  Then you have to creating another queue called Error queue

ErrorQueue-1

Creating Error Queue

ErrorQueue-2

Giving Error Queue Name

ErrorQueue-3

Targeting Error Queue

3. Configuring the error queue in the normal queue.

ErrorQueue-4

Configuring Error Queue

ErrorQueue-5

Setting Parameters for the Error Queue

This way we can make sure that once the messages is not been able to be delivered then it would try to re-deliver the same message for 3 times as set in Redelivery Limit in an interval of 1000 milliseconds which was set in Redeliver Delay and if even then that message has not got delivered then based on the Expiration Policy as Redirect the message would be directed to the Error Destination which we have created as MyErrorQueue.

This way we take out the poison messages out of the normal queue and let the other messages get delivered properly without affecting the flow of the messages.

NOTE:
– Error destination must be configured on the same JMS server as the destination for which it is defined.
– If no error destination is configured/selected when we chose the Expiration Policy as Redirect , then undeliverable messages are simply deleted.

Hope this post would help you guys to understand the concept of error queue, so do let us know if it did by commenting below  Smile

Regards,

Ravish Mody

If you enjoyed this post, please considerleaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.