3 Replies Latest reply on Oct 27, 2009 10:02 PM by Yong Hao Gao

    1.4.x Topic Subscriber and TTL'ed Messages

    Chiang Seng Chang Newbie

      Hi,

      JBoss Messaging version 1.4.x

      We have a JMS Topic where we post messages with TTL of (say) 2 weeks.

      Our clients create durable subscriptions to the topic.

      After creating the durable subscription, the client may return to consume the messages later (may be daily, weekly, monthly, etc).

      Since the clients are not always online, message consumption is by TopicSubscriber.receive() function (NOT by message listeners)

      The issue we encounter is when a subscription has many expired (TTL'ed) messages.

      JBoss Messaging only gets rid of expired messages "on-the-fly" when the TopicSubscriber.receive() is called. It can take non-trival minutes to get to the first non-expired message if the subscription contains many expired messages.

      We currently uses TopicSubscriber.receive(5000), which means if JBoss Messaging cannot get to the 1st non-expired message within 5 seconds, it returns null (no message).

      To "worsen" the problem, message consumption is via a RPC-style facade function and will most likely timed out.

      Is there anyway to configure JBoss Messaging to delete expired message actively via perhaps some kind of cron job?

      Or any other suggestions?

      Thank you.


      p.s. The topic is deployed in a cluster. We have thought of using a nightly cron job to receive() using CLIENT_ACKNOWLEDGE and rollback to get rid of the expired messages... but we cannot find a way to reliably get to the specific connection managers of each node within the cluster. (i.e. we may get the connection manager of cluster A even though we point the jndi url to cluster B.)