Package org.apache.activemq.broker
Interface Broker
- All Superinterfaces:
Region,org.apache.activemq.Service
- All Known Implementing Classes:
AbstractAuthenticationBroker,AdvisoryBroker,AuthorizationBroker,BrokerBroadcaster,BrokerFilter,BrokerPluginSupport,CompositeDestinationBroker,ConnectionDotFileInterceptor,ConnectionSplitBroker,DestinationDotFileInterceptor,DestinationPathSeparatorBroker,DestinationsPlugin,DiscardingDLQBroker,DotFileInterceptorSupport,EmptyBroker,ErrorBroker,ForcePersistencyModeBroker,InsertableMutableBrokerFilter,JaasAuthenticationBroker,JaasCertificateAuthenticationBroker,JaasDualAuthenticationBroker,LoggingBrokerPlugin,ManagedRegionBroker,MulticastTraceBrokerPlugin,MutableBrokerFilter,RedeliveryPlugin,RegionBroker,SchedulerBroker,SimpleAuthenticationBroker,StatisticsBroker,SubQueueSelectorCacheBroker,TimeStampingBrokerPlugin,TraceBrokerPathPlugin,TransactionBroker,UDPTraceBrokerPlugin,UserIDBroker
The Message Broker which routes messages, maintains subscriptions and
connections, acknowledges messages and handles transactions.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddBroker(Connection connection, org.apache.activemq.command.BrokerInfo info) A remote Broker connectsvoidaddConnection(ConnectionContext context, org.apache.activemq.command.ConnectionInfo info) A client is establishing a connection with the broker.voidaddDestinationInfo(ConnectionContext context, org.apache.activemq.command.DestinationInfo info) Add and process a DestinationInfo objectvoidaddProducer(ConnectionContext context, org.apache.activemq.command.ProducerInfo info) Adds a producer.voidaddSession(ConnectionContext context, org.apache.activemq.command.SessionInfo info) Adds a session.voidbeginTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid) Starts a transaction.voidcalled when the brokerService startsvoidcommitTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid, boolean onePhase) Commits a transaction.voidfastProducer(ConnectionContext context, org.apache.activemq.command.ProducerInfo producerInfo, org.apache.activemq.command.ActiveMQDestination destination) Called to notify a producer is too fastvoidforgetTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId transactionId) Forgets a transaction.getAdaptor(Class<?> type) Get a Broker from the Broker Stack that is a particular classorg.apache.activemq.command.BrokerIdGet the id of the brokerGet the name of the brokerlongMap<org.apache.activemq.command.ActiveMQDestination,Destination> getDestinationMap(org.apache.activemq.command.ActiveMQDestination destination) return a reference destination map of a region based on the destination typeorg.apache.activemq.command.ActiveMQDestination[]Set<org.apache.activemq.command.ActiveMQDestination>called to get Java thread pool executororg.apache.activemq.command.BrokerInfo[]Get the BrokerInfo's of any connected Brokersorg.apache.activemq.command.TransactionId[]getPreparedTransactions(ConnectionContext context) Gets a list of all the prepared xa transactions.getRoot()Ensure we get the Broker at the top of the Stackorg.apache.activemq.thread.Schedulercalled to get scheduler for executing TimerTaskbooleanisExpired(org.apache.activemq.broker.region.MessageReference messageReference) Determine if a message has expired -allows default behaviour to be overridden - as the timestamp set by the producer can be out of sync with the brokerbooleanvoidisFull(ConnectionContext context, Destination destination, org.apache.activemq.usage.Usage<?> usage) Called when a Usage reaches a limitbooleanvoidmessageConsumed(ConnectionContext context, org.apache.activemq.broker.region.MessageReference messageReference) called when message is consumedvoidmessageDelivered(ConnectionContext context, org.apache.activemq.broker.region.MessageReference messageReference) Called when message is delivered to the brokervoidmessageDiscarded(ConnectionContext context, Subscription sub, org.apache.activemq.broker.region.MessageReference messageReference) Called when a message is discarded - e.g. running low on memory This will happen only if the policy is enabled - e.g. non-durable topicsvoidmessageDispatched(ConnectionContext context, Subscription sub, org.apache.activemq.broker.region.MessageReference messageReference) Called when message is dispatched to a consumervoidmessageExpired(ConnectionContext context, org.apache.activemq.broker.region.MessageReference messageReference, Subscription subscription) A Message has ExpiredvoidnetworkBridgeStarted(org.apache.activemq.command.BrokerInfo brokerInfo, boolean createdByDuplex, String remoteIp) called to when a network bridge is startedvoidnetworkBridgeStopped(org.apache.activemq.command.BrokerInfo brokerInfo) called to when a network bridge is stoppedvoidcalled when the broker becomes the master in a master/slave configurationvoidpostProcessDispatch(org.apache.activemq.command.MessageDispatch messageDispatch) Notify the Broker that a dispatch has happenedintprepareTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid) Prepares a transaction.voidpreProcessDispatch(org.apache.activemq.command.MessageDispatch messageDispatch) Notify the Broker that a dispatch is going to happenvoidremoveBroker(Connection connection, org.apache.activemq.command.BrokerInfo info) Remove a BrokerInfovoidremoveConnection(ConnectionContext context, org.apache.activemq.command.ConnectionInfo info, Throwable error) A client is disconnecting from the broker.voidremoveDestinationInfo(ConnectionContext context, org.apache.activemq.command.DestinationInfo info) Remove and process a DestinationInfo objectvoidremoveProducer(ConnectionContext context, org.apache.activemq.command.ProducerInfo info) Removes a producer.voidremoveSession(ConnectionContext context, org.apache.activemq.command.SessionInfo info) Removes a session.voidrollbackTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid) Rollback a transaction.booleansendToDeadLetterQueue(ConnectionContext context, org.apache.activemq.broker.region.MessageReference messageReference, Subscription subscription, Throwable poisonCause) A message needs to go to the DLQvoidsetAdminConnectionContext(ConnectionContext adminConnectionContext) Sets the default administration connection context used when configuring the broker on startup or via JMXvoidslowConsumer(ConnectionContext context, Destination destination, Subscription subs) Called when there is a slow consumervoidvirtualDestinationAdded(ConnectionContext context, VirtualDestination virtualDestination) voidvirtualDestinationRemoved(ConnectionContext context, VirtualDestination virtualDestination) Methods inherited from interface org.apache.activemq.broker.region.Region
acknowledge, addConsumer, addDestination, gc, getDestinationMap, getDestinations, messagePull, processConsumerControl, processDispatchNotification, reapplyInterceptor, removeConsumer, removeDestination, removeSubscription, sendMethods inherited from interface org.apache.activemq.Service
start, stop
-
Method Details
-
getAdaptor
Get a Broker from the Broker Stack that is a particular class- Parameters:
type- a Broker type.- Returns:
- a Broker instance.
-
getBrokerId
org.apache.activemq.command.BrokerId getBrokerId()Get the id of the broker -
getBrokerName
String getBrokerName()Get the name of the broker -
addBroker
A remote Broker connects -
removeBroker
Remove a BrokerInfo- Parameters:
connection- Broker connectioninfo- metadata about the Broker
-
addConnection
void addConnection(ConnectionContext context, org.apache.activemq.command.ConnectionInfo info) throws Exception A client is establishing a connection with the broker.- Throws:
Exception- TODO
-
removeConnection
void removeConnection(ConnectionContext context, org.apache.activemq.command.ConnectionInfo info, Throwable error) throws Exception A client is disconnecting from the broker.- Parameters:
context- the environment the operation is being executed under.info- metadata about the Brokererror- null if the client requested the disconnect or the error that caused the client to disconnect.- Throws:
Exception- TODO
-
addSession
void addSession(ConnectionContext context, org.apache.activemq.command.SessionInfo info) throws Exception Adds a session.- Parameters:
context- connection contextinfo- metadata about the Broker- Throws:
Exception- TODO
-
removeSession
void removeSession(ConnectionContext context, org.apache.activemq.command.SessionInfo info) throws Exception Removes a session.- Parameters:
context- connection contextinfo- metadata about the Broker- Throws:
Exception- TODO
-
addProducer
void addProducer(ConnectionContext context, org.apache.activemq.command.ProducerInfo info) throws Exception Adds a producer.- Specified by:
addProducerin interfaceRegion- Parameters:
context- the environment the operation is being executed under.- Throws:
Exception- TODO
-
removeProducer
void removeProducer(ConnectionContext context, org.apache.activemq.command.ProducerInfo info) throws Exception Removes a producer.- Specified by:
removeProducerin interfaceRegion- Parameters:
context- the environment the operation is being executed under.- Throws:
Exception- TODO
-
getClients
- Returns:
- all clients added to the Broker.
- Throws:
Exception- TODO
-
getDestinations
- Returns:
- all destinations added to the Broker.
- Throws:
Exception- TODO
-
getDestinationMap
Map<org.apache.activemq.command.ActiveMQDestination,Destination> getDestinationMap(org.apache.activemq.command.ActiveMQDestination destination) return a reference destination map of a region based on the destination type- Parameters:
destination- ActiveMQ Destination- Returns:
- destination Map
-
getPreparedTransactions
org.apache.activemq.command.TransactionId[] getPreparedTransactions(ConnectionContext context) throws Exception Gets a list of all the prepared xa transactions.- Parameters:
context- transaction ids- Returns:
- array of TransactionId values
- Throws:
Exception- TODO
-
beginTransaction
void beginTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid) throws Exception Starts a transaction.- Parameters:
context- connection contextxid- transaction id- Throws:
Exception- TODO
-
prepareTransaction
int prepareTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid) throws Exception Prepares a transaction. Only valid for xa transactions.- Parameters:
context- connection contextxid- transaction id- Returns:
- id
- Throws:
Exception- TODO
-
rollbackTransaction
void rollbackTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid) throws Exception Rollback a transaction.- Parameters:
context- connection contextxid- transaction id- Throws:
Exception- TODO
-
commitTransaction
void commitTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid, boolean onePhase) throws Exception Commits a transaction.- Parameters:
context- connection contextxid- transaction idonePhase- is COMMIT_ONE_PHASE- Throws:
Exception- TODO
-
forgetTransaction
void forgetTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId transactionId) throws Exception Forgets a transaction.- Parameters:
context- connection contexttransactionId- transaction id- Throws:
Exception- TODO
-
getPeerBrokerInfos
org.apache.activemq.command.BrokerInfo[] getPeerBrokerInfos()Get the BrokerInfo's of any connected Brokers- Returns:
- array of peer BrokerInfos
-
preProcessDispatch
void preProcessDispatch(org.apache.activemq.command.MessageDispatch messageDispatch) Notify the Broker that a dispatch is going to happen- Parameters:
messageDispatch- MessageDispatch object being dispatched
-
postProcessDispatch
void postProcessDispatch(org.apache.activemq.command.MessageDispatch messageDispatch) Notify the Broker that a dispatch has happened- Parameters:
messageDispatch- MessageDispatch that has dispatched
-
isStopped
boolean isStopped()- Returns:
- true if the broker has stopped
-
getDurableDestinations
Set<org.apache.activemq.command.ActiveMQDestination> getDurableDestinations()- Returns:
- a Set of all durable destinations
-
addDestinationInfo
void addDestinationInfo(ConnectionContext context, org.apache.activemq.command.DestinationInfo info) throws Exception Add and process a DestinationInfo object- Parameters:
context- connection contextinfo- destination info- Throws:
Exception- TODO
-
removeDestinationInfo
void removeDestinationInfo(ConnectionContext context, org.apache.activemq.command.DestinationInfo info) throws Exception Remove and process a DestinationInfo object- Parameters:
context- connection contextinfo- destination info- Throws:
Exception- TODO
-
isFaultTolerantConfiguration
boolean isFaultTolerantConfiguration()- Returns:
- true if fault-tolerant
-
getAdminConnectionContext
ConnectionContext getAdminConnectionContext()- Returns:
- the connection context used to make administration operations on startup or via JMX MBeans
-
setAdminConnectionContext
Sets the default administration connection context used when configuring the broker on startup or via JMX- Parameters:
adminConnectionContext- default administration connection context
-
getTempDataStore
PListStore getTempDataStore()- Returns:
- the temp data store
-
getVmConnectorURI
URI getVmConnectorURI()- Returns:
- the URI that can be used to connect to the local Broker
-
brokerServiceStarted
void brokerServiceStarted()called when the brokerService starts -
getBrokerService
BrokerService getBrokerService()- Returns:
- the BrokerService
-
getRoot
Broker getRoot()Ensure we get the Broker at the top of the Stack- Returns:
- the broker at the top of the Stack
-
isExpired
boolean isExpired(org.apache.activemq.broker.region.MessageReference messageReference) Determine if a message has expired -allows default behaviour to be overridden - as the timestamp set by the producer can be out of sync with the broker- Parameters:
messageReference- message reference- Returns:
- true if the message is expired
-
messageExpired
void messageExpired(ConnectionContext context, org.apache.activemq.broker.region.MessageReference messageReference, Subscription subscription) A Message has Expired- Parameters:
context- connection contextmessageReference- message referencesubscription- (maybe null)
-
sendToDeadLetterQueue
boolean sendToDeadLetterQueue(ConnectionContext context, org.apache.activemq.broker.region.MessageReference messageReference, Subscription subscription, Throwable poisonCause) A message needs to go to the DLQ- Parameters:
context- connection contextmessageReference- message referencepoisonCause- reason for dlq submission, may be null- Returns:
- true if Message was placed in a DLQ false if discarded.
-
getBrokerSequenceId
long getBrokerSequenceId()- Returns:
- the broker sequence id
-
messageConsumed
void messageConsumed(ConnectionContext context, org.apache.activemq.broker.region.MessageReference messageReference) called when message is consumed- Parameters:
context- connection contextmessageReference- message reference
-
messageDelivered
void messageDelivered(ConnectionContext context, org.apache.activemq.broker.region.MessageReference messageReference) Called when message is delivered to the broker- Parameters:
context- connection contextmessageReference- message reference
-
messageDispatched
void messageDispatched(ConnectionContext context, Subscription sub, org.apache.activemq.broker.region.MessageReference messageReference) Called when message is dispatched to a consumer- Parameters:
context- connection contextsub- subscriptionmessageReference- message reference
-
messageDiscarded
void messageDiscarded(ConnectionContext context, Subscription sub, org.apache.activemq.broker.region.MessageReference messageReference) Called when a message is discarded - e.g. running low on memory This will happen only if the policy is enabled - e.g. non-durable topics- Parameters:
context- connection contextsub- subscriptionmessageReference- message reference
-
slowConsumer
Called when there is a slow consumer- Parameters:
context- connection contextdestination- destinationsubs- subscription
-
fastProducer
void fastProducer(ConnectionContext context, org.apache.activemq.command.ProducerInfo producerInfo, org.apache.activemq.command.ActiveMQDestination destination) Called to notify a producer is too fast- Parameters:
context- connection contextproducerInfo- producer infodestination- destination
-
isFull
void isFull(ConnectionContext context, Destination destination, org.apache.activemq.usage.Usage<?> usage) Called when a Usage reaches a limit- Parameters:
context- create new scratch file from selectiondestination- destinationusage- usage
-
virtualDestinationAdded
-
virtualDestinationRemoved
-
nowMasterBroker
void nowMasterBroker()called when the broker becomes the master in a master/slave configuration -
getScheduler
org.apache.activemq.thread.Scheduler getScheduler()called to get scheduler for executing TimerTask -
getExecutor
ThreadPoolExecutor getExecutor()called to get Java thread pool executor -
networkBridgeStarted
void networkBridgeStarted(org.apache.activemq.command.BrokerInfo brokerInfo, boolean createdByDuplex, String remoteIp) called to when a network bridge is started- Parameters:
brokerInfo- metadata about the brokercreatedByDuplex- is created by duplexremoteIp- ip address of the broker
-
networkBridgeStopped
void networkBridgeStopped(org.apache.activemq.command.BrokerInfo brokerInfo) called to when a network bridge is stopped- Parameters:
brokerInfo- metadata about the broker
-