Class PostOfficeImpl
java.lang.Object
org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl
- All Implemented Interfaces:
BindingsFactory,PostOffice,ActiveMQComponent,NotificationListener
public class PostOfficeImpl
extends Object
implements PostOffice, NotificationListener, BindingsFactory
This is the class that will make the routing to Queues and decide which consumer will get the messages It's the queue
component on distributing the messages * *
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SimpleStringstatic final SimpleStringstatic final SimpleString -
Constructor Summary
ConstructorsConstructorDescriptionPostOfficeImpl(ActiveMQServer server, StorageManager storageManager, PagingManager pagingManager, QueueFactory bindableFactory, ManagementService managementService, long expiryReaperPeriod, long addressQueueReaperPeriod, WildcardConfiguration wildcardConfiguration, int idCacheSize, boolean persistIDCache, HierarchicalRepository<AddressSettings> addressSettingsRepository) -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddAddressInfo(AddressInfo addressInfo) Returns true if the address was added, false if it wasn't added.voidaddBinding(Binding binding) protected static voidapplyExpiryDelay(Message message, AddressSettings settings) createBindings(SimpleString address) findLocalBinding(long bindingID) getAddressInfo(SimpleString addressName) getBinding(SimpleString name) getBindingsForAddress(SimpleString address) Differently to lookupBindings, this will always create a new element on the Queue if non-existentgetDirectBindings(SimpleString address) getDuplicateIDCache(SimpleString address) getDuplicateIDCache(SimpleString address, int cacheSizeToUse) getMatchingBindings(SimpleString address) getMatchingQueue(SimpleString address, RoutingType routingType) getMatchingQueue(SimpleString address, SimpleString queueName, RoutingType routingType) booleanisAddressBound(SimpleString address) booleanlistQueuesForAddress(SimpleString address) lookupBindingsForAddress(SimpleString address) It will lookup the Binding without creating an item on the Queue if non-existentvoidnotifyBindingUpdatedForQueue(QueueBinding binding) voidonNotification(Notification notification) voidpostAcknowledge(MessageReference ref, AckReason reason) voidpreAcknowledge(Transaction tx, MessageReference ref, AckReason reason) static voidprocessReference(MessageReference ref, boolean direct) static voidprocessReferences(List<MessageReference> refs, boolean direct) voidprocessRoute(Message message, RoutingContext context, boolean direct) redistribute(Message message, Queue originatingQueue) The redistribution can't process the route right away as we may be dealing with a large message which will need to be processed on a different threadreload(Message message, Queue queue, Transaction tx) voidreloadAddressInfo(AddressInfo addressInfo) removeAddressInfo(SimpleString address) removeAddressInfo(SimpleString address, boolean force) removeBinding(SimpleString uniqueName, Transaction tx, boolean deleteData) route(Message message, RoutingContext context, boolean direct) route(Message message, RoutingContext context, boolean direct, boolean rejectDuplicates, Binding bindingMove) route(Message message, Transaction tx, boolean direct) route(Message message, Transaction tx, boolean direct, boolean rejectDuplicates) route(Message message, Transaction tx, boolean direct, boolean rejectDuplicates, Binding binding) voidscanAddresses(MirrorController mirrorController) voidsendQueueInfoToQueue(SimpleString queueName, SimpleString address) setMirrorControlSource(MirrorController mirrorControllerSource) voidstart()voidvoidThe expiry scanner can't be started until the whole server has been started other wise you may get racesvoidstop()static voidstoreDurableReference(StorageManager storageManager, Message message, Transaction tx, Queue queue, boolean sync) toString()updateAddressInfo(SimpleString addressName, EnumSet<RoutingType> routingTypes) updateQueue(QueueConfiguration queueConfiguration) updateQueue(QueueConfiguration queueConfiguration, boolean forceUpdate) Update a queue's configuration.updateQueue(SimpleString name, RoutingType routingType, Filter filter, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean groupRebalance, Integer groupBuckets, SimpleString groupFirstKey, Boolean nonDestructive, Integer consumersBeforeDispatch, Long delayBeforeDispatch, SimpleString user, Boolean configurationManaged) Deprecated.updateQueue(SimpleString name, RoutingType routingType, Filter filter, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean groupRebalance, Integer groupBuckets, SimpleString groupFirstKey, Boolean nonDestructive, Integer consumersBeforeDispatch, Long delayBeforeDispatch, SimpleString user, Boolean configurationManaged, Long ringSize) Deprecated.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.activemq.artemis.core.server.ActiveMQComponent
asyncStopMethods inherited from interface org.apache.activemq.artemis.core.postoffice.PostOffice
findQueue, reroute
-
Field Details
-
HDR_RESET_QUEUE_DATA
-
HDR_RESET_QUEUE_DATA_COMPLETE
-
BRIDGE_CACHE_STR
-
-
Constructor Details
-
PostOfficeImpl
public PostOfficeImpl(ActiveMQServer server, StorageManager storageManager, PagingManager pagingManager, QueueFactory bindableFactory, ManagementService managementService, long expiryReaperPeriod, long addressQueueReaperPeriod, WildcardConfiguration wildcardConfiguration, int idCacheSize, boolean persistIDCache, HierarchicalRepository<AddressSettings> addressSettingsRepository)
-
-
Method Details
-
start
- Specified by:
startin interfaceActiveMQComponent- Throws:
Exception
-
stop
- Specified by:
stopin interfaceActiveMQComponent- Throws:
Exception
-
isStarted
public boolean isStarted()- Specified by:
isStartedin interfaceActiveMQComponent
-
getMirrorControlSource
- Specified by:
getMirrorControlSourcein interfacePostOffice
-
setMirrorControlSource
- Specified by:
setMirrorControlSourcein interfacePostOffice
-
preAcknowledge
- Specified by:
preAcknowledgein interfacePostOffice
-
postAcknowledge
- Specified by:
postAcknowledgein interfacePostOffice
-
scanAddresses
- Specified by:
scanAddressesin interfacePostOffice- Throws:
Exception
-
onNotification
- Specified by:
onNotificationin interfaceNotificationListener
-
reloadAddressInfo
- Specified by:
reloadAddressInfoin interfacePostOffice- Throws:
Exception
-
addAddressInfo
Description copied from interface:PostOfficeReturns true if the address was added, false if it wasn't added.- Specified by:
addAddressInfoin interfacePostOffice- Returns:
- true if the address was added, false if it wasn't added
- Throws:
Exception
-
updateQueue
@Deprecated public QueueBinding updateQueue(SimpleString name, RoutingType routingType, Filter filter, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean groupRebalance, Integer groupBuckets, SimpleString groupFirstKey, Boolean nonDestructive, Integer consumersBeforeDispatch, Long delayBeforeDispatch, SimpleString user, Boolean configurationManaged) throws Exception Deprecated.- Specified by:
updateQueuein interfacePostOffice- Throws:
Exception
-
updateQueue
@Deprecated public QueueBinding updateQueue(SimpleString name, RoutingType routingType, Filter filter, Integer maxConsumers, Boolean purgeOnNoConsumers, Boolean exclusive, Boolean groupRebalance, Integer groupBuckets, SimpleString groupFirstKey, Boolean nonDestructive, Integer consumersBeforeDispatch, Long delayBeforeDispatch, SimpleString user, Boolean configurationManaged, Long ringSize) throws Exception Deprecated.- Specified by:
updateQueuein interfacePostOffice- Throws:
Exception
-
updateQueue
- Specified by:
updateQueuein interfacePostOffice- Throws:
Exception
-
updateQueue
public QueueBinding updateQueue(QueueConfiguration queueConfiguration, boolean forceUpdate) throws Exception Description copied from interface:PostOfficeUpdate a queue's configuration.- Specified by:
updateQueuein interfacePostOfficeforceUpdate- Setting totruewill makenullvalues override current values too- Throws:
Exception
-
notifyBindingUpdatedForQueue
- Throws:
Exception
-
updateAddressInfo
public AddressInfo updateAddressInfo(SimpleString addressName, EnumSet<RoutingType> routingTypes) throws Exception - Specified by:
updateAddressInfoin interfacePostOffice- Throws:
Exception
-
removeAddressInfo
- Specified by:
removeAddressInfoin interfacePostOffice- Throws:
Exception
-
removeAddressInfo
- Specified by:
removeAddressInfoin interfacePostOffice- Throws:
Exception
-
getAddressInfo
- Specified by:
getAddressInfoin interfacePostOffice
-
listQueuesForAddress
- Specified by:
listQueuesForAddressin interfacePostOffice- Throws:
Exception
-
addBinding
- Specified by:
addBindingin interfacePostOffice- Throws:
Exception
-
removeBinding
public Binding removeBinding(SimpleString uniqueName, Transaction tx, boolean deleteData) throws Exception - Specified by:
removeBindingin interfacePostOffice- Throws:
Exception
-
isAddressBound
- Specified by:
isAddressBoundin interfaceBindingsFactory- Specified by:
isAddressBoundin interfacePostOffice- Throws:
Exception
-
getBindingsForAddress
Description copied from interface:PostOfficeDifferently to lookupBindings, this will always create a new element on the Queue if non-existent- Specified by:
getBindingsForAddressin interfacePostOffice- Throws:
Exception
-
lookupBindingsForAddress
Description copied from interface:PostOfficeIt will lookup the Binding without creating an item on the Queue if non-existent- Specified by:
lookupBindingsForAddressin interfacePostOffice- Throws:
Exception
-
findLocalBinding
- Specified by:
findLocalBindingin interfacePostOffice
-
getBinding
- Specified by:
getBindingin interfacePostOffice
-
getMatchingBindings
- Specified by:
getMatchingBindingsin interfacePostOffice- Throws:
Exception
-
getDirectBindings
- Specified by:
getDirectBindingsin interfacePostOffice- Throws:
Exception
-
getAllBindings
- Specified by:
getAllBindingsin interfacePostOffice
-
route
- Specified by:
routein interfacePostOffice- Throws:
Exception
-
route
- Specified by:
routein interfacePostOffice- Throws:
Exception
-
route
public RoutingStatus route(Message message, Transaction tx, boolean direct, boolean rejectDuplicates) throws Exception - Specified by:
routein interfacePostOffice- Throws:
Exception
-
route
public RoutingStatus route(Message message, Transaction tx, boolean direct, boolean rejectDuplicates, Binding binding) throws Exception - Specified by:
routein interfacePostOffice- Throws:
Exception
-
route
public RoutingStatus route(Message message, RoutingContext context, boolean direct) throws Exception - Specified by:
routein interfacePostOffice- Throws:
Exception
-
route
public RoutingStatus route(Message message, RoutingContext context, boolean direct, boolean rejectDuplicates, Binding bindingMove) throws Exception - Specified by:
routein interfacePostOffice- Throws:
Exception
-
applyExpiryDelay
-
reload
- Specified by:
reloadin interfacePostOffice- Throws:
Exception
-
redistribute
public Pair<RoutingContext,Message> redistribute(Message message, Queue originatingQueue) throws Exception The redistribution can't process the route right away as we may be dealing with a large message which will need to be processed on a different thread- Specified by:
redistributein interfacePostOffice- Throws:
Exception
-
getDuplicateIDCache
- Specified by:
getDuplicateIDCachein interfacePostOffice
-
getDuplicateIDCache
- Specified by:
getDuplicateIDCachein interfacePostOffice
-
getDuplicateIDCaches
-
getNotificationLock
- Specified by:
getNotificationLockin interfacePostOffice
-
getAddresses
- Specified by:
getAddressesin interfacePostOffice
-
getMatchingQueue
public SimpleString getMatchingQueue(SimpleString address, RoutingType routingType) throws Exception - Specified by:
getMatchingQueuein interfacePostOffice- Throws:
Exception
-
getMatchingQueue
public SimpleString getMatchingQueue(SimpleString address, SimpleString queueName, RoutingType routingType) throws Exception - Specified by:
getMatchingQueuein interfacePostOffice- Throws:
Exception
-
sendQueueInfoToQueue
- Specified by:
sendQueueInfoToQueuein interfacePostOffice- Throws:
Exception
-
toString
-
processRoute
- Specified by:
processRoutein interfacePostOffice- Throws:
Exception
-
processReferences
-
processReference
-
storeDurableReference
public static void storeDurableReference(StorageManager storageManager, Message message, Transaction tx, Queue queue, boolean sync) throws Exception - Throws:
Exception
-
startExpiryScanner
public void startExpiryScanner()The expiry scanner can't be started until the whole server has been started other wise you may get races- Specified by:
startExpiryScannerin interfacePostOffice
-
startAddressQueueScanner
public void startAddressQueueScanner()- Specified by:
startAddressQueueScannerin interfacePostOffice
-
createBindings
- Specified by:
createBindingsin interfaceBindingsFactory
-
getAddressManager
- Specified by:
getAddressManagerin interfacePostOffice
-
getServer
-