4 Replies Latest reply on Jun 23, 2010 4:38 PM by Tom B-Oracle

    Poison messages

      Hi All,
      I am new to Weblogic server.In my application I have deployed 3 queues which point to three different MDB's.
      My problem is that whenever a queue does not publish a message to its corresponing MDB because of timeout or if the message is a bad formatted message, I want that message to be sent to a new Queue called Timeout queue.
      Is this possible?If yes please let me know how I can achieve it.
      An immediate assistance would be appreciated.
      Thanks in advance.

        • 1. Re: Poison messages
          You can try setting the jms retry limit and error destination for auto moving the messages to the error queue.

          1 person found this helpful
          • 2. Re: Poison messages
            Tom B-Oracle
            Poison messages can be handled in a variety of ways, and there's a very nice three page discussion titled "Handling Poison messages" in the the JMS chapter of the book "Professional Oracle WebLogic Server".

            The following might apply in your case:

            - Configure a time-to-live override on the 3 original destinations, or programmatically set time-to-live in your application.

            - Configure a Q called Timeout.

            - Set the error destination for each destination to reference this Timeout Q.

            - Configure an expiration policy for the destination (to redirect expired messages to the error destination instead of simply discard them).

            - Configure a redelivery limit for the destination (max # of retries before messages are redirected to the error destination).

            On the other hand, these days I try not to recommend depending on the "redelivery limit" option. The problem is that this limit applies to all types of delivery failures that can force a redelivery, not just specifically your "message format incorrect" problem. The best option, if its not too much work, might be to modify your application so that it detects incorrectly formatted messages, or messages that have a high JMSXDeliveryCount value, and sends them them to a designated queue (a "BadlyFormattedMessage" queue) instead of forcing redelivery or attempting to process them...

            In addition, you may want to configure a "redelivery delay" to help prevent immediate redelivery of failed messages that can't be processed right away, but may be fine within a few seconds or a minute or so...

            Hope this helps,


            Edited by: TomB on Jun 21, 2010 6:43 PM
            • 3. Re: Poison messages
              Hi Tom/Atheek,
              Thanks for the response, now I am able to redirect the messages to my Timeout queue.
              However now I want to try pausing the consumption of the queue using an MBeanAgent class, which I am unable to do.I was successful in getting the MBeanServerConnection instance but when I am trying to invoke the method to pause the consumption I am getting an InstanceNotFound exception.
              Any assistance on this would be of great help.

              • 4. Re: Poison messages
                Tom B-Oracle
                The type string that you use to obtain your connection should be either "weblogic.management.mbeanservers.runtime" or "weblogic.management.mbeanservers.domainruntime" depending on whether your trying to work with only runtime mbeans for a particular server (the former) or all runtime mbeans for the entire domain (the latter).

                And if you're not familiar with how to find a particular mbean instance, an alternate approach is to get all instances of a particular type, you can use a wild card query such as:
                rtConnection.queryMBeans(new ObjectName("*:Type=" + type + ",*"), null);
                Where, if I recall correctly, type can be either "JMSDestinationRuntime" or "JMSServerRuntime" (which both have pause/resume methods).

                Hope this helps,


                Edited by: TomB on Jun 23, 2010 12:37 PM