1 Reply Latest reply on Aug 29, 2011 5:27 PM by ryanhos

    JMS-messages with an expiry date (time-to-live) never expire

    metalhead

      I would like to delete any jms-messages which could not be delivered to the subscriber after a small period.

       

      So in my code I set the default timeToLive of my TopicPublisher to 30 seconds and I set the message timeToLive to 30 seconds, but the messages never seem to get expired.

       

      Some pieces of java-code:

      [code]

      TopicPublisher publisher = ...;

      publisher.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

      publisher.setTimeToLive(30000);

       

      publisher.publish(message, DeliveryMode.NON_PERSISTENT, publisher.getPriority(), 30000);

      [/code]

       

      I also tried to set the DLQ and the ExpiryQueue, but it makes no difference: the messages stay in the conventional JMS-queue...

       

      Can someone point me in the right direction how I can solve this?

       

      Thanks in advance...

        • 1. Re: JMS-messages with an expiry date (time-to-live) never expire
          ryanhos

          "The messgaes stay in the conventional JMS-queue."

           

          The JMS Spec only demands that expired messages never be delivered to clients.  Expirations in JBM appear to be processed when a client requests messages from the queue/topic.  There is no background thread that automatically moves messages to the ExpiryQueue at the moment of expiration.  Are the expired messages being delivered to your message clients?  I suspect that they will be sent to the ExpiryQueue once a client attempts to pull the message.