0 Replies Latest reply on Jun 7, 2010 8:23 AM by akos.baraz

    Message expiration in durable subscriptions.

    akos.baraz

      Hi,

       

      I would like to implement a house keeper for the durable subscriptions of a topic. We want to delete the offline subscriptions if there are too many messages in them or the client was not connected for a while (one week in this case).

       

      My first thought was to use the message expiration mechanism. I tried to set the expireMessagesPeriod, but it is working with queues only (although it makes sense for durable subscriptions). Then I tried the constantPendingMessageLimitStrategy, but the pending queue is growing endlessly even if I set this prop. (I don't see any code in the DurableTopicSubscription what would handle the limit strategy, but in the TopicSubscription only.)

       

      Then i've tried to do it differently. I've introduced a thread what checks the consumers of the given topic.

      First of all the DurableTopicSubscription.getPendingQueueSize() does not check the persistent store, so even if keepDurableSubsActive=true we never get the correct size of the never-activated subscriptions. It shows the message count from the broker restart.

      The second problem is if keepDurableSubsActive=true then the session.unsubscribe (or broker.removeSubscription) does not remove the consumer from the topic's Destination.getConsumers() list. This list contains the unsubscribed consumers also, in this way my code cannot rely on this list.

       

      Do you have other idea what can maintain the subscriptions? Or can you fix the problems in the broker?

       

      Thank you for your help!

      akos