2 Replies Latest reply on Mar 2, 2012 12:06 PM by Ogroef-Oracle

    Question about JMSExpiration

      At my customer we are sending messages to Topics by using the 'javax.jms'-library and everything goes fine except for the content of the 'JMSExpiration'-field.

      All the documentation that I read on how to set this field (in milliseconds) is telling me that when I use the 'Publish'-method from the 'TopicPublisher'-class it will make the sum of the 'TimeToLive'-parameter and the moment that message is send by the Pubblisher.

      TimeToLive parameter: 5000 ms (5sec)
      Publisher send time: X

      When message is consumed by other party the 'JMSExpiration'-filed is holding x+5000, while my customer is asking to have only 5000 in the JSExpiration.

      Is there any way how that I can achieve this?
      Any comments are appreciated
      Also when it is not possible I would like to know (Just for me to know that I read the documentation well) !

      Kind Regards
      Olivier De Groef
        • 1. Re: Question about JMSExpiration
          Nigel Deakin-Oracle
          The behaviour of the getJMSExpiration() method on javax.jms.Message is defined in the usual place:
          It is as you describe.

          If you want to pass the time-to-live (or any other) value to the consuming client the easiest way to do this is to set a custom message property:

          before the producing client sends the message, set a message property called, say "myTTL" to whatever TTL value you are using:

          the consuming client can extract this value using:
          long timeToLive = message.getLongProperty("myTTL");

          • 2. Re: Question about JMSExpiration

            Thx for the achnowledgement that I understood the doc wel. The link is indeed the documentation that I have read about this.

            Also the sugested solution is one thing that I had in mind.

            Kind Regards