0
votes

I need to set message expiry for my message in a JMS Topic. I have tried by setting the properties of message.setJMSExpiration() and producer.getTimeToLive() methods. But I don't think so the messages which I posted still alive in Topic which I posted.

My doubt is whether these properties are used to discard the unsubscribed message from topic after the expiration time arrived? or after the message subscribed by a particular subscriber.

I have used selector to identify the particular client.

If any of the above property is not enough to make message expire then do I need any other configuration to make the message expire in producer side?

Am using Apache ActiveMQ 5.8.0 with JDK 1.6

2

2 Answers

0
votes

My two cents of info. Hope this helps you to identify the problem you have.

There are two types of subscriptions, Durable and Non-durable subscription and subscribers (or applications that create subscriptions) are called Durable and Non-durable subscribers respectively.

Non-durable subscribers receive publications as long as the applications are running. Durable subscriptions receive publications even when the receiving applications are not running. Durable subscriptions are backed by storage (usually, queues) and messaging providers put the publications into the storage when applications are not running.

If there are no subscriptions for a topic, Messaging Provider will simply discard the publication.

Message Expiry (a.k.a TimeToLive ) is applicable to both types of subscriptions. If the subscriber application does not receive messages before the expiry, such messages expire and will not be delivered to receiving application.

Messages can only expire only after the producer publishes to Messaging Provider.

0
votes

1) Per the JMS spec, all QoS settings (persistence, expiry (aka TTL) and priority must be set on the Producer object. When set on the Message object, they are ignored.

2) Would need to see client code to validate the value of the TTL is set correctly.

3) TTL value is the time in milliseconds to expire the message (i.e. 300000 for 5 minutes), not the time from EPOCH.