5 Replies Latest reply: Jan 12, 2011 10:07 PM by pmackin RSS

    Messaging Pattern Questions

    823083
      1/ Is there anyway to add filters on to your subscriptions? i.e. if a subscriber was interested in only messsages that matched a certain criteria.

      2/ If I have a durable topic destination, with 2 subscribers, both subscribers are valid. Now subscriber 2 gets disconnected, 100 messages are published. Subsciber one gets all the messages. Subscriber 2 never connects again. Are the 100 messages stored indefinitely? Or is the subscriber lease to counter this? i.e if the lease is 2minutes and the subscriber does not connect back within 2 minutes, the 100 messages are thrown away?

      Thanks,
        • 1. Re: Messaging Pattern Questions
          823083
          A couple more questions...

          - If I create a topic and publish 100 messages to it and have no subscribers to the topic. How long are the messages stored on the topic for? Indefinately? Or is there a way to configure/set this?

          - How do I remove destinations once they are not required?
          • 2. Re: Messaging Pattern Questions
            pmackin
            Hi

            Sorry for the delayed response.

            1) No, there are no filters on subscriptions.

            2) An expiring lease will not delete a durable subscription so the messages will remain in the cache until the client re-subscribes to the same durable subscription and consumes the messages.

            Paul
            • 3. Re: Messaging Pattern Questions
              pmackin
              Hi

              Here are the answers to your additional questions:

              1) If a topic has no subscriptions then the message will not be published to it. There needs to be at least one subscription. This is different from Queues, where messages will be published even if there are no subscriptions.

              2) There is no way to remove destinations using the existing API.

              Paul
              • 4. Re: Messaging Pattern Questions
                823083
                Thanks for the responses.

                So from them I gather that a durable subscription will remain active, and all messages will build up in the cache until, either...

                - The subscrivber consumes the messages, or
                - The subscriber unsubscribes from the durable subscription.

                1/ Please can you then explain what is the functionality of the lease period, what is it and how is it used?

                2/ How do I prevent a large amonunt of messages building up in the cache, it a durable subscriber does not connect back to the topic?

                Thanks,
                Ash
                • 5. Re: Messaging Pattern Questions
                  pmackin
                  Hi
                  So from them I gather that a durable subscription will remain active, and all messages will build up in the cache until, either...

                  - The subscrivber consumes the messages, or
                  - The subscriber unsubscribes from the durable subscription.
                  Yes
                  1/ Please can you then explain what is the functionality of the lease period, what is it and how is it used?
                  The lease is used to clean up subscriptions when a client terminates without unsubscribing. If the subscription is not durable then it will be deleted and all messages will be notified that the subscription no longer has interest in the messages. In the case where the subscription was the last or only subscription, the messages will be deleted.

                  If the subscription is durable the the messages will be rolled back but the subscription will remain. As a result, the messages will remain in the cache.

                  2/ How do I prevent a large amonunt of messages building up in the cache, it a durable subscriber does not connect back to the topic?
                  You can't. Messages delivered to a durable subscription will remain in the cache until you unsubscribe or consume and acknowledge the messages.

                  Paul