Package org.apache.activemq.plugin
Class SubQueueSelectorCacheBroker
- java.lang.Object
-
- org.apache.activemq.broker.BrokerFilter
-
- org.apache.activemq.plugin.SubQueueSelectorCacheBroker
-
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 Summary
Fields Modifier and Type Field Description static String
MATCH_EVERYTHING
static long
MAX_PERSIST_INTERVAL
-
Fields inherited from class org.apache.activemq.broker.BrokerFilter
next
-
-
Constructor Summary
Constructors Constructor Description SubQueueSelectorCacheBroker(Broker next, File persistFile)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Subscription
addConsumer(ConnectionContext context, ConsumerInfo info)
Adds a consumer.boolean
deleteAllSelectorsForDestination(String destinationName)
boolean
deleteSelectorForDestination(String destinationName, String selector)
long
getPersistInterval()
Set<String>
getSelectorsForDestination(String destinationName)
boolean
isIgnoreWildcardSelectors()
boolean
isSingleSelectorPerDestination()
void
removeConsumer(ConnectionContext context, ConsumerInfo info)
Removes a consumer.void
run()
Persist the selector cache everyMAX_PERSIST_INTERVAL
ms.void
setIgnoreWildcardSelectors(boolean ignoreWildcardSelectors)
void
setPersistInterval(long persistInterval)
void
setSingleSelectorPerDestination(boolean singleSelectorPerDestination)
void
stop()
-
Methods inherited from class org.apache.activemq.broker.BrokerFilter
acknowledge, addBroker, addConnection, addDestination, addDestinationInfo, addProducer, addSession, beginTransaction, brokerServiceStarted, commitTransaction, fastProducer, forgetTransaction, gc, getAdaptor, getAdminConnectionContext, getBrokerId, getBrokerName, getBrokerSequenceId, getBrokerService, getClients, getDestinationMap, getDestinationMap, getDestinations, getDestinations, getDurableDestinations, getExecutor, getNext, getPeerBrokerInfos, getPreparedTransactions, getRoot, getScheduler, getTempDataStore, getVmConnectorURI, isExpired, isFaultTolerantConfiguration, isFull, isStopped, messageConsumed, messageDelivered, messageDiscarded, messageExpired, messagePull, networkBridgeStarted, networkBridgeStopped, nowMasterBroker, postProcessDispatch, prepareTransaction, preProcessDispatch, processConsumerControl, processDispatchNotification, reapplyInterceptor, removeBroker, removeConnection, removeDestination, removeDestinationInfo, removeProducer, removeSession, removeSubscription, rollbackTransaction, send, sendToDeadLetterQueue, setAdminConnectionContext, slowConsumer, start, virtualDestinationAdded, virtualDestinationRemoved
-
-
-
-
Field Detail
-
MATCH_EVERYTHING
public static final String MATCH_EVERYTHING
- See Also:
- Constant Field Values
-
MAX_PERSIST_INTERVAL
public static final long MAX_PERSIST_INTERVAL
- See Also:
- Constant Field Values
-
-
Method Detail
-
stop
public void stop() throws Exception
- Specified by:
stop
in interfaceService
- Overrides:
stop
in classBrokerFilter
- Throws:
Exception
-
addConsumer
public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception
Description copied from interface:Region
Adds a consumer.- Specified by:
addConsumer
in interfaceRegion
- Overrides:
addConsumer
in classBrokerFilter
- Parameters:
context
- the environment the operation is being executed under.- Returns:
- TODO
- Throws:
Exception
- TODO
-
removeConsumer
public void removeConsumer(ConnectionContext context, ConsumerInfo info) throws Exception
Description copied from interface:Region
Removes a consumer.- Specified by:
removeConsumer
in interfaceRegion
- Overrides:
removeConsumer
in classBrokerFilter
- Parameters:
context
- the environment the operation is being executed under.- Throws:
Exception
- TODO
-
run
public void run()
Persist the selector cache everyMAX_PERSIST_INTERVAL
ms.- Specified by:
run
in interfaceRunnable
- See Also:
Runnable.run()
-
isSingleSelectorPerDestination
public boolean isSingleSelectorPerDestination()
-
setSingleSelectorPerDestination
public void setSingleSelectorPerDestination(boolean singleSelectorPerDestination)
-
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)
-
-