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 Modifier and Type Class Description static classPostOfficeImpl.AddOperation
-
Field Summary
Fields Modifier and Type Field Description static SimpleStringBRIDGE_CACHE_STRstatic SimpleStringHDR_RESET_QUEUE_DATAstatic SimpleStringHDR_RESET_QUEUE_DATA_COMPLETE
-
Constructor Summary
Constructors Constructor Description 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 Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanaddAddressInfo(AddressInfo addressInfo)voidaddBinding(Binding binding)BindingscreateBindings(SimpleString address)Set<SimpleString>getAddresses()AddressInfogetAddressInfo(SimpleString addressName)AddressManagergetAddressManager()Stream<Binding>getAllBindings()BindinggetBinding(SimpleString name)BindingsgetBindingsForAddress(SimpleString address)Differently to lookupBindings, this will always create a new element on the Queue if non-existentCollection<Binding>getDirectBindings(SimpleString address)DuplicateIDCachegetDuplicateIDCache(SimpleString address)DuplicateIDCachegetDuplicateIDCache(SimpleString address, int cacheSizeToUse)ConcurrentMap<SimpleString,DuplicateIDCache>getDuplicateIDCaches()Collection<Binding>getMatchingBindings(SimpleString address)SimpleStringgetMatchingQueue(SimpleString address, RoutingType routingType)SimpleStringgetMatchingQueue(SimpleString address, SimpleString queueName, RoutingType routingType)MirrorControllergetMirrorControlSource()ObjectgetNotificationLock()ActiveMQServergetServer()booleanisAddressBound(SimpleString address)booleanisStarted()List<Queue>listQueuesForAddress(SimpleString address)BindingslookupBindingsForAddress(SimpleString address)It will lookup the Binding without creating an item on the Queue if non-existentvoidonNotification(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)Pair<RoutingContext,Message>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 threadMessageReferencereload(Message message, Queue queue, Transaction tx)voidreloadAddressInfo(AddressInfo addressInfo)AddressInforemoveAddressInfo(SimpleString address)AddressInforemoveAddressInfo(SimpleString address, boolean force)BindingremoveBinding(SimpleString uniqueName, Transaction tx, boolean deleteData)RoutingStatusroute(Message message, boolean direct)RoutingStatusroute(Message message, RoutingContext context, boolean direct)RoutingStatusroute(Message message, RoutingContext context, boolean direct, boolean rejectDuplicates, Binding bindingMove)RoutingStatusroute(Message message, Transaction tx, boolean direct)RoutingStatusroute(Message message, Transaction tx, boolean direct, boolean rejectDuplicates)RoutingStatusroute(Message message, Transaction tx, boolean direct, boolean rejectDuplicates, Binding binding)voidscanAddresses(MirrorController mirrorController)voidsendQueueInfoToQueue(SimpleString queueName, SimpleString address)PostOfficeImplsetMirrorControlSource(MirrorController mirrorControllerSource)voidstart()voidstartAddressQueueScanner()voidstartExpiryScanner()The 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)StringtoString()AddressInfoupdateAddressInfo(SimpleString addressName, EnumSet<RoutingType> routingTypes)QueueBindingupdateQueue(QueueConfiguration queueConfiguration)QueueBindingupdateQueue(QueueConfiguration queueConfiguration, boolean forceUpdate)QueueBindingupdateQueue(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.QueueBindingupdateQueue(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, wait
-
Methods inherited from interface org.apache.activemq.artemis.core.server.ActiveMQComponent
asyncStop
-
Methods inherited from interface org.apache.activemq.artemis.core.postoffice.PostOffice
reroute
-
-
-
-
Field Detail
-
HDR_RESET_QUEUE_DATA
public static final SimpleString HDR_RESET_QUEUE_DATA
-
HDR_RESET_QUEUE_DATA_COMPLETE
public static final SimpleString HDR_RESET_QUEUE_DATA_COMPLETE
-
BRIDGE_CACHE_STR
public static final SimpleString BRIDGE_CACHE_STR
-
-
Constructor Detail
-
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 Detail
-
start
public void start() throws Exception- Specified by:
startin interfaceActiveMQComponent- Throws:
Exception
-
stop
public void stop() throws Exception- Specified by:
stopin interfaceActiveMQComponent- Throws:
Exception
-
isStarted
public boolean isStarted()
- Specified by:
isStartedin interfaceActiveMQComponent
-
getMirrorControlSource
public MirrorController getMirrorControlSource()
- Specified by:
getMirrorControlSourcein interfacePostOffice
-
setMirrorControlSource
public PostOfficeImpl setMirrorControlSource(MirrorController mirrorControllerSource)
- Specified by:
setMirrorControlSourcein interfacePostOffice
-
preAcknowledge
public void preAcknowledge(Transaction tx, MessageReference ref, AckReason reason)
- Specified by:
preAcknowledgein interfacePostOffice
-
postAcknowledge
public void postAcknowledge(MessageReference ref, AckReason reason)
- Specified by:
postAcknowledgein interfacePostOffice
-
scanAddresses
public void scanAddresses(MirrorController mirrorController) throws Exception
- Specified by:
scanAddressesin interfacePostOffice- Throws:
Exception
-
onNotification
public void onNotification(Notification notification)
- Specified by:
onNotificationin interfaceNotificationListener
-
reloadAddressInfo
public void reloadAddressInfo(AddressInfo addressInfo) throws Exception
- Specified by:
reloadAddressInfoin interfacePostOffice- Throws:
Exception
-
addAddressInfo
public boolean addAddressInfo(AddressInfo addressInfo) throws Exception
- 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
public QueueBinding updateQueue(QueueConfiguration queueConfiguration) throws Exception
- Specified by:
updateQueuein interfacePostOffice- Throws:
Exception
-
updateQueue
public QueueBinding updateQueue(QueueConfiguration queueConfiguration, boolean forceUpdate) throws Exception
- Specified by:
updateQueuein interfacePostOfficeforceUpdate- Setting totruewill makenullvalues override current values too- Returns:
- Throws:
Exception
-
updateAddressInfo
public AddressInfo updateAddressInfo(SimpleString addressName, EnumSet<RoutingType> routingTypes) throws Exception
- Specified by:
updateAddressInfoin interfacePostOffice- Throws:
Exception
-
removeAddressInfo
public AddressInfo removeAddressInfo(SimpleString address) throws Exception
- Specified by:
removeAddressInfoin interfacePostOffice- Throws:
Exception
-
removeAddressInfo
public AddressInfo removeAddressInfo(SimpleString address, boolean force) throws Exception
- Specified by:
removeAddressInfoin interfacePostOffice- Throws:
Exception
-
getAddressInfo
public AddressInfo getAddressInfo(SimpleString addressName)
- Specified by:
getAddressInfoin interfacePostOffice
-
listQueuesForAddress
public List<Queue> listQueuesForAddress(SimpleString address) throws Exception
- Specified by:
listQueuesForAddressin interfacePostOffice- Throws:
Exception
-
addBinding
public void addBinding(Binding binding) throws Exception
- 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
public boolean isAddressBound(SimpleString address) throws Exception
- Specified by:
isAddressBoundin interfaceBindingsFactory- Specified by:
isAddressBoundin interfacePostOffice- Throws:
Exception
-
getBindingsForAddress
public Bindings getBindingsForAddress(SimpleString address) throws Exception
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
public Bindings lookupBindingsForAddress(SimpleString address) throws Exception
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
-
getBinding
public Binding getBinding(SimpleString name)
- Specified by:
getBindingin interfacePostOffice
-
getMatchingBindings
public Collection<Binding> getMatchingBindings(SimpleString address) throws Exception
- Specified by:
getMatchingBindingsin interfacePostOffice- Throws:
Exception
-
getDirectBindings
public Collection<Binding> getDirectBindings(SimpleString address) throws Exception
- Specified by:
getDirectBindingsin interfacePostOffice- Throws:
Exception
-
getAllBindings
public Stream<Binding> getAllBindings()
- Specified by:
getAllBindingsin interfacePostOffice
-
route
public RoutingStatus route(Message message, boolean direct) throws Exception
- Specified by:
routein interfacePostOffice- Throws:
Exception
-
route
public RoutingStatus route(Message message, Transaction tx, boolean direct) throws Exception
- 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
-
reload
public MessageReference reload(Message message, Queue queue, Transaction tx) throws Exception
- 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
public DuplicateIDCache getDuplicateIDCache(SimpleString address)
- Specified by:
getDuplicateIDCachein interfacePostOffice
-
getDuplicateIDCache
public DuplicateIDCache getDuplicateIDCache(SimpleString address, int cacheSizeToUse)
- Specified by:
getDuplicateIDCachein interfacePostOffice
-
getDuplicateIDCaches
public ConcurrentMap<SimpleString,DuplicateIDCache> getDuplicateIDCaches()
-
getNotificationLock
public Object getNotificationLock()
- Specified by:
getNotificationLockin interfacePostOffice
-
getAddresses
public Set<SimpleString> 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
public void sendQueueInfoToQueue(SimpleString queueName, SimpleString address) throws Exception
- Specified by:
sendQueueInfoToQueuein interfacePostOffice- Throws:
Exception
-
processRoute
public void processRoute(Message message, RoutingContext context, boolean direct) throws Exception
- Specified by:
processRoutein interfacePostOffice- Throws:
Exception
-
processReferences
public static void processReferences(List<MessageReference> refs, boolean direct)
-
processReference
public static void processReference(MessageReference ref, boolean direct)
-
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
public Bindings createBindings(SimpleString address)
- Specified by:
createBindingsin interfaceBindingsFactory
-
getAddressManager
public AddressManager getAddressManager()
- Specified by:
getAddressManagerin interfacePostOffice
-
getServer
public ActiveMQServer getServer()
-
-