Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-2779

Propagate queue subscription selectors to virtual topic dispatch such that unmatched messages do not pile up on subscription queues

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.3.2
    • 5.4.0
    • Selector
    • None
    • all

    Description

      With virtual topics each consumer can get its own queue or share an existing queue. http://activemq.apache.org/virtual-destinations.html

      Consumers which share a queue, can use selectors to partition the consumer queue but individual consumers that use selectors run into a problem in that the dispatch to the queue does not take account of the selector and all messages are dispatched to the queue. Over time, the unmatched messages build up on the queue.
      Through static configuration it is possible to arrange that the destination queues are filtered, but this solution is static.

      An alternative approach, that does impose a cpu hit during dispatch (as the selectors are executed twice) can provide a neat solution. Making a virtual topic selectorAware allows the destination interceptor to only dispatch messages that match the selector of one of the existing subscriptions. In this way, no unmatched messages will be dispatched to the subscription queues. In xml configuration, the following will make all topic dispatch respect the selectors of the existing subscriptions:

      <broker xmlns="http://activemq.apache.org/schema/core">
          <destinationInterceptors>
            <virtualDestinationInterceptor>
              <virtualDestinations>
                <virtualTopic name=">" selectorAware="true"/>
              </virtualDestinations>
            </virtualDestinationInterceptor>
          </destinationInterceptors>
      
        </broker>

      Attachments

        Activity

          People

            gtully Gary Tully
            gtully Gary Tully
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: