Package org.apache.activemq.broker
Class EmptyBroker
- java.lang.Object
-
- org.apache.activemq.broker.EmptyBroker
-
-
Constructor Summary
Constructors Constructor Description EmptyBroker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack)
Used to acknowledge the receipt of a message by a client.void
addBroker(Connection connection, BrokerInfo info)
A remote Broker connectsvoid
addConnection(ConnectionContext context, ConnectionInfo info)
A client is establishing a connection with the broker.Subscription
addConsumer(ConnectionContext context, ConsumerInfo info)
Adds a consumer.Destination
addDestination(ConnectionContext context, ActiveMQDestination destination, boolean flag)
Used to create a destination.void
addDestinationInfo(ConnectionContext context, DestinationInfo info)
Add and process a DestinationInfo objectvoid
addProducer(ConnectionContext context, ProducerInfo info)
Adds a producer.void
addSession(ConnectionContext context, SessionInfo info)
Adds a session.void
beginTransaction(ConnectionContext context, TransactionId xid)
Starts a transaction.void
brokerServiceStarted()
called when the brokerService startsvoid
commitTransaction(ConnectionContext context, TransactionId xid, boolean onePhase)
Commits a transaction.void
fastProducer(ConnectionContext context, ProducerInfo producerInfo, ActiveMQDestination destination)
Called to notify a producer is too fastvoid
forgetTransaction(ConnectionContext context, TransactionId transactionId)
Forgets a transaction.void
gc()
Broker
getAdaptor(Class<?> type)
Get a Broker from the Broker Stack that is a particular classConnectionContext
getAdminConnectionContext()
BrokerId
getBrokerId()
Get the id of the brokerString
getBrokerName()
Get the name of the brokerlong
getBrokerSequenceId()
BrokerService
getBrokerService()
Connection[]
getClients()
Map<ActiveMQDestination,Destination>
getDestinationMap()
Returns a reference to the concurrent hash map that holds known destinations, do not modifyMap<ActiveMQDestination,Destination>
getDestinationMap(ActiveMQDestination destination)
return a reference destination map of a region based on the destination typeActiveMQDestination[]
getDestinations()
Set<Destination>
getDestinations(ActiveMQDestination destination)
Provide an exact or wildcard lookup of destinations in the regionSet<ActiveMQDestination>
getDurableDestinations()
ThreadPoolExecutor
getExecutor()
BrokerInfo[]
getPeerBrokerInfos()
Get the BrokerInfo's of any connected BrokersTransactionId[]
getPreparedTransactions(ConnectionContext context)
Gets a list of all the prepared xa transactions.Broker
getRoot()
Ensure we get the Broker at the top of the StackScheduler
getScheduler()
PListStore
getTempDataStore()
URI
getVmConnectorURI()
boolean
isExpired(MessageReference messageReference)
Determine if a message has expired -allows default behaviour to be overriden - as the timestamp set by the producer can be out of sync with the brokerboolean
isFaultTolerantConfiguration()
void
isFull(ConnectionContext context, Destination destination, Usage<?> usage)
Called when a Usage reaches a limitboolean
isStopped()
void
messageConsumed(ConnectionContext context, MessageReference messageReference)
called when message is consumedvoid
messageDelivered(ConnectionContext context, MessageReference messageReference)
Called when message is delivered to the brokervoid
messageDiscarded(ConnectionContext context, Subscription sub, MessageReference messageReference)
Called when a message is discarded - e.g.void
messageExpired(ConnectionContext context, MessageReference message, Subscription subscription)
A Message has ExpiredResponse
messagePull(ConnectionContext context, MessagePull pull)
Allows a consumer to pull a message from a queuevoid
networkBridgeStarted(BrokerInfo brokerInfo, boolean createdByDuplex, String remoteIp)
void
networkBridgeStopped(BrokerInfo brokerInfo)
void
nowMasterBroker()
called when the broker becomes the master in a master/slave configurationvoid
postProcessDispatch(MessageDispatch messageDispatch)
Notify the Broker that a dispatch has happenedint
prepareTransaction(ConnectionContext context, TransactionId xid)
Prepares a transaction.void
preProcessDispatch(MessageDispatch messageDispatch)
Notify the Broker that a dispatch is going to happenvoid
processConsumerControl(ConsumerBrokerExchange consumerExchange, ConsumerControl control)
void
processDispatchNotification(MessageDispatchNotification messageDispatchNotification)
Process a notification of a dispatch - used by a Slave Brokervoid
reapplyInterceptor()
void
removeBroker(Connection connection, BrokerInfo info)
Remove a BrokerInfovoid
removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error)
A client is disconnecting from the broker.void
removeConsumer(ConnectionContext context, ConsumerInfo info)
Removes a consumer.void
removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout)
Used to destroy a destination.void
removeDestinationInfo(ConnectionContext context, DestinationInfo info)
Remove and process a DestinationInfo objectvoid
removeProducer(ConnectionContext context, ProducerInfo info)
Removes a producer.void
removeSession(ConnectionContext context, SessionInfo info)
Removes a session.void
removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info)
Deletes a durable subscription.void
rollbackTransaction(ConnectionContext context, TransactionId xid)
Rollsback a transaction.void
send(ProducerBrokerExchange producerExchange, Message message)
Send a message to the broker to using the specified destination.boolean
sendToDeadLetterQueue(ConnectionContext context, MessageReference messageReference, Subscription subscription, Throwable poisonCause)
A message needs to go the a DLQvoid
setAdminConnectionContext(ConnectionContext adminConnectionContext)
Sets the default administration connection context used when configuring the broker on startup or via JMXvoid
slowConsumer(ConnectionContext context, Destination destination, Subscription subs)
Called when there is a slow consumervoid
start()
void
stop()
void
virtualDestinationAdded(ConnectionContext context, VirtualDestination virtualDestination)
void
virtualDestinationRemoved(ConnectionContext context, VirtualDestination virtualDestination)
-
-
-
Method Detail
-
getBrokerId
public BrokerId getBrokerId()
Description copied from interface:Broker
Get the id of the broker- Specified by:
getBrokerId
in interfaceBroker
-
getBrokerName
public String getBrokerName()
Description copied from interface:Broker
Get the name of the broker- Specified by:
getBrokerName
in interfaceBroker
-
getAdaptor
public Broker getAdaptor(Class<?> type)
Description copied from interface:Broker
Get a Broker from the Broker Stack that is a particular class- Specified by:
getAdaptor
in interfaceBroker
- Returns:
- a Broker instance.
-
getDestinationMap
public Map<ActiveMQDestination,Destination> getDestinationMap()
Description copied from interface:Region
Returns a reference to the concurrent hash map that holds known destinations, do not modify- Specified by:
getDestinationMap
in interfaceRegion
-
getDestinationMap
public Map<ActiveMQDestination,Destination> getDestinationMap(ActiveMQDestination destination)
Description copied from interface:Broker
return a reference destination map of a region based on the destination type- Specified by:
getDestinationMap
in interfaceBroker
- Returns:
- destination Map
-
getDestinations
public Set<Destination> getDestinations(ActiveMQDestination destination)
Description copied from interface:Region
Provide an exact or wildcard lookup of destinations in the region- Specified by:
getDestinations
in interfaceRegion
- Returns:
- a set of matching destination objects.
-
addConnection
public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception
Description copied from interface:Broker
A client is establishing a connection with the broker.- Specified by:
addConnection
in interfaceBroker
- Throws:
Exception
- TODO
-
removeConnection
public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception
Description copied from interface:Broker
A client is disconnecting from the broker.- Specified by:
removeConnection
in interfaceBroker
- Parameters:
context
- the environment the operation is being executed under.error
- null if the client requested the disconnect or the error that caused the client to disconnect.- Throws:
Exception
- TODO
-
addSession
public void addSession(ConnectionContext context, SessionInfo info) throws Exception
Description copied from interface:Broker
Adds a session.- Specified by:
addSession
in interfaceBroker
- Throws:
Exception
- TODO
-
removeSession
public void removeSession(ConnectionContext context, SessionInfo info) throws Exception
Description copied from interface:Broker
Removes a session.- Specified by:
removeSession
in interfaceBroker
- Throws:
Exception
- TODO
-
addProducer
public void addProducer(ConnectionContext context, ProducerInfo info) throws Exception
Description copied from interface:Broker
Adds a producer.- Specified by:
addProducer
in interfaceBroker
- Specified by:
addProducer
in interfaceRegion
- Parameters:
context
- the environment the operation is being executed under.- Throws:
Exception
- TODO
-
removeProducer
public void removeProducer(ConnectionContext context, ProducerInfo info) throws Exception
Description copied from interface:Broker
Removes a producer.- Specified by:
removeProducer
in interfaceBroker
- Specified by:
removeProducer
in interfaceRegion
- Parameters:
context
- the environment the operation is being executed under.- Throws:
Exception
- TODO
-
getClients
public Connection[] getClients() throws Exception
- Specified by:
getClients
in interfaceBroker
- Returns:
- all clients added to the Broker.
- Throws:
Exception
- TODO
-
getDestinations
public ActiveMQDestination[] getDestinations() throws Exception
- Specified by:
getDestinations
in interfaceBroker
- Returns:
- all destinations added to the Broker.
- Throws:
Exception
- TODO
-
getPreparedTransactions
public TransactionId[] getPreparedTransactions(ConnectionContext context) throws Exception
Description copied from interface:Broker
Gets a list of all the prepared xa transactions.- Specified by:
getPreparedTransactions
in interfaceBroker
- Parameters:
context
- transaction ids- Returns:
- array of TransactionId values
- Throws:
Exception
- TODO
-
beginTransaction
public void beginTransaction(ConnectionContext context, TransactionId xid) throws Exception
Description copied from interface:Broker
Starts a transaction.- Specified by:
beginTransaction
in interfaceBroker
- Throws:
Exception
- TODO
-
prepareTransaction
public int prepareTransaction(ConnectionContext context, TransactionId xid) throws Exception
Description copied from interface:Broker
Prepares a transaction. Only valid for xa transactions.- Specified by:
prepareTransaction
in interfaceBroker
- Returns:
- id
- Throws:
Exception
- TODO
-
rollbackTransaction
public void rollbackTransaction(ConnectionContext context, TransactionId xid) throws Exception
Description copied from interface:Broker
Rollsback a transaction.- Specified by:
rollbackTransaction
in interfaceBroker
- Throws:
Exception
- TODO
-
commitTransaction
public void commitTransaction(ConnectionContext context, TransactionId xid, boolean onePhase) throws Exception
Description copied from interface:Broker
Commits a transaction.- Specified by:
commitTransaction
in interfaceBroker
- Throws:
Exception
- TODO
-
forgetTransaction
public void forgetTransaction(ConnectionContext context, TransactionId transactionId) throws Exception
Description copied from interface:Broker
Forgets a transaction.- Specified by:
forgetTransaction
in interfaceBroker
- Throws:
Exception
-
addDestination
public Destination addDestination(ConnectionContext context, ActiveMQDestination destination, boolean flag) throws Exception
Description copied from interface:Region
Used to create a destination. Usually, this method is invoked as a side-effect of sending a message to a destination that does not exist yet.- Specified by:
addDestination
in interfaceRegion
destination
- the destination to create.- Returns:
- TODO
- Throws:
Exception
- TODO
-
removeDestination
public void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout) throws Exception
Description copied from interface:Region
Used to destroy a destination. This should try to quiesce use of the destination up to the timeout allotted time before removing the destination. This will remove all persistent messages associated with the destination.- Specified by:
removeDestination
in interfaceRegion
- Parameters:
context
- the environment the operation is being executed under.destination
- what is being removed from the broker.timeout
- the max amount of time to wait for the destination to quiesce- Throws:
Exception
- TODO
-
addConsumer
public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception
Description copied from interface:Region
Adds a consumer.- Specified by:
addConsumer
in interfaceRegion
- 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
- Parameters:
context
- the environment the operation is being executed under.- Throws:
Exception
- TODO
-
removeSubscription
public void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception
Description copied from interface:Region
Deletes a durable subscription.- Specified by:
removeSubscription
in interfaceRegion
- Parameters:
context
- the environment the operation is being executed under.info
- TODO- Throws:
Exception
- TODO
-
send
public void send(ProducerBrokerExchange producerExchange, Message message) throws Exception
Description copied from interface:Region
Send a message to the broker to using the specified destination. The destination specified in the message does not need to match the destination the message is sent to. This is handy in case the message is being sent to a dead letter destination.
-
acknowledge
public void acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack) throws Exception
Description copied from interface:Region
Used to acknowledge the receipt of a message by a client.- Specified by:
acknowledge
in interfaceRegion
- Parameters:
consumerExchange
- the environment the operation is being executed under.- Throws:
Exception
- TODO
-
start
public void start() throws Exception
-
addBroker
public void addBroker(Connection connection, BrokerInfo info)
Description copied from interface:Broker
A remote Broker connects
-
removeBroker
public void removeBroker(Connection connection, BrokerInfo info)
Description copied from interface:Broker
Remove a BrokerInfo- Specified by:
removeBroker
in interfaceBroker
-
getPeerBrokerInfos
public BrokerInfo[] getPeerBrokerInfos()
Description copied from interface:Broker
Get the BrokerInfo's of any connected Brokers- Specified by:
getPeerBrokerInfos
in interfaceBroker
- Returns:
- array of peer BrokerInfos
-
preProcessDispatch
public void preProcessDispatch(MessageDispatch messageDispatch)
Description copied from interface:Broker
Notify the Broker that a dispatch is going to happen- Specified by:
preProcessDispatch
in interfaceBroker
-
postProcessDispatch
public void postProcessDispatch(MessageDispatch messageDispatch)
Description copied from interface:Broker
Notify the Broker that a dispatch has happened- Specified by:
postProcessDispatch
in interfaceBroker
-
processDispatchNotification
public void processDispatchNotification(MessageDispatchNotification messageDispatchNotification) throws Exception
Description copied from interface:Region
Process a notification of a dispatch - used by a Slave Broker- Specified by:
processDispatchNotification
in interfaceRegion
- Throws:
Exception
- TODO
-
isStopped
public boolean isStopped()
-
getDurableDestinations
public Set<ActiveMQDestination> getDurableDestinations()
- Specified by:
getDurableDestinations
in interfaceBroker
- Returns:
- a Set of all durable destinations
-
addDestinationInfo
public void addDestinationInfo(ConnectionContext context, DestinationInfo info) throws Exception
Description copied from interface:Broker
Add and process a DestinationInfo object- Specified by:
addDestinationInfo
in interfaceBroker
- Throws:
Exception
-
removeDestinationInfo
public void removeDestinationInfo(ConnectionContext context, DestinationInfo info) throws Exception
Description copied from interface:Broker
Remove and process a DestinationInfo object- Specified by:
removeDestinationInfo
in interfaceBroker
- Throws:
Exception
-
isFaultTolerantConfiguration
public boolean isFaultTolerantConfiguration()
- Specified by:
isFaultTolerantConfiguration
in interfaceBroker
- Returns:
- true if fault tolerant
-
getAdminConnectionContext
public ConnectionContext getAdminConnectionContext()
- Specified by:
getAdminConnectionContext
in interfaceBroker
- Returns:
- the connection context used to make administration operations on startup or via JMX MBeans
-
setAdminConnectionContext
public void setAdminConnectionContext(ConnectionContext adminConnectionContext)
Description copied from interface:Broker
Sets the default administration connection context used when configuring the broker on startup or via JMX- Specified by:
setAdminConnectionContext
in interfaceBroker
-
messagePull
public Response messagePull(ConnectionContext context, MessagePull pull) throws Exception
Description copied from interface:Region
Allows a consumer to pull a message from a queue- Specified by:
messagePull
in interfaceRegion
- Throws:
Exception
-
getTempDataStore
public PListStore getTempDataStore()
- Specified by:
getTempDataStore
in interfaceBroker
- Returns:
- the temp data store
-
getVmConnectorURI
public URI getVmConnectorURI()
- Specified by:
getVmConnectorURI
in interfaceBroker
- Returns:
- the URI that can be used to connect to the local Broker
-
brokerServiceStarted
public void brokerServiceStarted()
Description copied from interface:Broker
called when the brokerService starts- Specified by:
brokerServiceStarted
in interfaceBroker
-
getBrokerService
public BrokerService getBrokerService()
- Specified by:
getBrokerService
in interfaceBroker
- Returns:
- the BrokerService
-
isExpired
public boolean isExpired(MessageReference messageReference)
Description copied from interface:Broker
Determine if a message has expired -allows default behaviour to be overriden - as the timestamp set by the producer can be out of sync with the broker
-
messageExpired
public void messageExpired(ConnectionContext context, MessageReference message, Subscription subscription)
Description copied from interface:Broker
A Message has Expired- Specified by:
messageExpired
in interfaceBroker
subscription
- (may be null)
-
sendToDeadLetterQueue
public boolean sendToDeadLetterQueue(ConnectionContext context, MessageReference messageReference, Subscription subscription, Throwable poisonCause)
Description copied from interface:Broker
A message needs to go the a DLQ- Specified by:
sendToDeadLetterQueue
in interfaceBroker
poisonCause
- reason for dlq submission, may be null- Returns:
- true if Message was placed in a DLQ false if discarded.
-
getRoot
public Broker getRoot()
Description copied from interface:Broker
Ensure we get the Broker at the top of the Stack
-
getBrokerSequenceId
public long getBrokerSequenceId()
- Specified by:
getBrokerSequenceId
in interfaceBroker
- Returns:
- the broker sequence id
-
fastProducer
public void fastProducer(ConnectionContext context, ProducerInfo producerInfo, ActiveMQDestination destination)
Description copied from interface:Broker
Called to notify a producer is too fast- Specified by:
fastProducer
in interfaceBroker
-
isFull
public void isFull(ConnectionContext context, Destination destination, Usage<?> usage)
Description copied from interface:Broker
Called when a Usage reaches a limit
-
messageConsumed
public void messageConsumed(ConnectionContext context, MessageReference messageReference)
Description copied from interface:Broker
called when message is consumed- Specified by:
messageConsumed
in interfaceBroker
-
messageDelivered
public void messageDelivered(ConnectionContext context, MessageReference messageReference)
Description copied from interface:Broker
Called when message is delivered to the broker- Specified by:
messageDelivered
in interfaceBroker
-
messageDiscarded
public void messageDiscarded(ConnectionContext context, Subscription sub, MessageReference messageReference)
Description copied from interface:Broker
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- Specified by:
messageDiscarded
in interfaceBroker
-
slowConsumer
public void slowConsumer(ConnectionContext context, Destination destination, Subscription subs)
Description copied from interface:Broker
Called when there is a slow consumer- Specified by:
slowConsumer
in interfaceBroker
-
virtualDestinationAdded
public void virtualDestinationAdded(ConnectionContext context, VirtualDestination virtualDestination)
- Specified by:
virtualDestinationAdded
in interfaceBroker
-
virtualDestinationRemoved
public void virtualDestinationRemoved(ConnectionContext context, VirtualDestination virtualDestination)
- Specified by:
virtualDestinationRemoved
in interfaceBroker
-
nowMasterBroker
public void nowMasterBroker()
Description copied from interface:Broker
called when the broker becomes the master in a master/slave configuration- Specified by:
nowMasterBroker
in interfaceBroker
-
networkBridgeStarted
public void networkBridgeStarted(BrokerInfo brokerInfo, boolean createdByDuplex, String remoteIp)
- Specified by:
networkBridgeStarted
in interfaceBroker
-
networkBridgeStopped
public void networkBridgeStopped(BrokerInfo brokerInfo)
- Specified by:
networkBridgeStopped
in interfaceBroker
-
processConsumerControl
public void processConsumerControl(ConsumerBrokerExchange consumerExchange, ConsumerControl control)
- Specified by:
processConsumerControl
in interfaceRegion
-
reapplyInterceptor
public void reapplyInterceptor()
- Specified by:
reapplyInterceptor
in interfaceRegion
-
getScheduler
public Scheduler getScheduler()
- Specified by:
getScheduler
in interfaceBroker
-
getExecutor
public ThreadPoolExecutor getExecutor()
- Specified by:
getExecutor
in interfaceBroker
-
-