Class SubQueueSelectorCacheBroker

java.lang.Object
org.apache.activemq.broker.BrokerFilter
org.apache.activemq.plugin.SubQueueSelectorCacheBroker
All Implemented Interfaces:
Runnable, Broker, Region, org.apache.activemq.Service

public class SubQueueSelectorCacheBroker extends BrokerFilter implements Runnable
A plugin which allows the caching of the selector from a subscription queue.

This stops the build-up of unwanted messages, especially when consumers may disconnect from time to time when using virtual destinations.

This is influenced by code snippets developed by Maciej Rakowicz Refer to: https://issues.apache.org/activemq/browse/AMQ-3004 http://mail-archives.apache.org/mod_mbox/activemq-users/201011.mbox/%3C8A013711-2613-450A-A487-379E784AF1D6@homeaway.co.uk%3E

  • Field Details

  • Constructor Details

    • SubQueueSelectorCacheBroker

      public SubQueueSelectorCacheBroker(Broker next, File persistFile)
      Constructor
  • Method Details

    • stop

      public void stop() throws Exception
      Specified by:
      stop in interface org.apache.activemq.Service
      Overrides:
      stop in class BrokerFilter
      Throws:
      Exception
    • addConsumer

      public Subscription addConsumer(ConnectionContext context, org.apache.activemq.command.ConsumerInfo info) throws Exception
      Description copied from interface: Region
      Adds a consumer.
      Specified by:
      addConsumer in interface Region
      Overrides:
      addConsumer in class BrokerFilter
      Parameters:
      context - the environment the operation is being executed under.
      Returns:
      TODO
      Throws:
      Exception - TODO
    • removeConsumer

      public void removeConsumer(ConnectionContext context, org.apache.activemq.command.ConsumerInfo info) throws Exception
      Description copied from interface: Region
      Removes a consumer.
      Specified by:
      removeConsumer in interface Region
      Overrides:
      removeConsumer in class BrokerFilter
      Parameters:
      context - the environment the operation is being executed under.
      Throws:
      Exception - TODO
    • run

      public void run()
      Persist the selector cache every MAX_PERSIST_INTERVALms.
      Specified by:
      run in interface Runnable
      See Also:
    • isSingleSelectorPerDestination

      public boolean isSingleSelectorPerDestination()
    • setSingleSelectorPerDestination

      public void setSingleSelectorPerDestination(boolean singleSelectorPerDestination)
    • getSelectorsForDestination

      public Set<String> getSelectorsForDestination(String destinationName)
    • getPersistInterval

      public long getPersistInterval()
    • setPersistInterval

      public void setPersistInterval(long persistInterval)
    • deleteSelectorForDestination

      public boolean deleteSelectorForDestination(String destinationName, String selector)
    • deleteAllSelectorsForDestination

      public boolean deleteAllSelectorsForDestination(String destinationName)
    • isIgnoreWildcardSelectors

      public boolean isIgnoreWildcardSelectors()
    • setIgnoreWildcardSelectors

      public void setIgnoreWildcardSelectors(boolean ignoreWildcardSelectors)