public class RegionBroker extends EmptyBroker
Modifier and Type | Field and Description |
---|---|
protected BrokerService |
brokerService |
protected Map<ConnectionId,ConnectionState> |
connectionStates |
protected DestinationFactory |
destinationFactory |
protected DestinationStatistics |
destinationStatistics |
static String |
ORIGINAL_EXPIRATION |
Constructor and Description |
---|
RegionBroker(BrokerService brokerService,
TaskRunnerFactory taskRunnerFactory,
SystemUsage memoryManager,
DestinationFactory destinationFactory,
DestinationInterceptor destinationInterceptor,
Scheduler scheduler,
ThreadPoolExecutor executor) |
Modifier and Type | Method and 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 connects
|
protected void |
addBrokerInClusterUpdate(BrokerInfo info) |
void |
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 createIfTemp)
Used to create a destination.
|
void |
addDestinationInfo(ConnectionContext context,
DestinationInfo info)
Add and process a DestinationInfo object
|
void |
addProducer(ConnectionContext context,
ProducerInfo info)
Adds a producer.
|
void |
beginTransaction(ConnectionContext context,
TransactionId xid)
Starts a transaction.
|
void |
brokerServiceStarted()
called when the brokerService starts
|
void |
commitTransaction(ConnectionContext context,
TransactionId xid,
boolean onePhase)
Commits a transaction.
|
protected Region |
createQueueRegion(SystemUsage memoryManager,
TaskRunnerFactory taskRunnerFactory,
DestinationFactory destinationFactory) |
protected Region |
createTempQueueRegion(SystemUsage memoryManager,
TaskRunnerFactory taskRunnerFactory,
DestinationFactory destinationFactory) |
protected Region |
createTempTopicRegion(SystemUsage memoryManager,
TaskRunnerFactory taskRunnerFactory,
DestinationFactory destinationFactory) |
protected Region |
createTopicRegion(SystemUsage memoryManager,
TaskRunnerFactory taskRunnerFactory,
DestinationFactory destinationFactory) |
protected javax.jms.JMSException |
createUnknownDestinationTypeException(ActiveMQDestination destination) |
protected void |
doStop(ServiceStopper ss) |
void |
forgetTransaction(ConnectionContext context,
TransactionId transactionId)
Forgets a transaction.
|
void |
gc() |
ConnectionContext |
getAdminConnectionContext() |
BrokerId |
getBrokerId()
Get the id of the broker
|
String |
getBrokerName()
Get the name of the broker
|
long |
getBrokerSequenceId() |
BrokerService |
getBrokerService() |
Connection[] |
getClients() |
ConnectionContext |
getConnectionContext(String clientId) |
Map<ConnectionId,ConnectionState> |
getConnectionStates() |
DestinationInterceptor |
getDestinationInterceptor() |
Map<ActiveMQDestination,Destination> |
getDestinationMap()
Returns a reference to the concurrent hash map that holds known destinations, do not modify
|
Map<ActiveMQDestination,Destination> |
getDestinationMap(ActiveMQDestination destination)
return a reference destination map of a region based on the destination type
|
PolicyMap |
getDestinationPolicy() |
ActiveMQDestination[] |
getDestinations() |
Set<Destination> |
getDestinations(ActiveMQDestination destination)
Provide an exact or wildcard lookup of destinations in the region
|
DestinationStatistics |
getDestinationStatistics() |
Set<ActiveMQDestination> |
getDurableDestinations() |
ThreadPoolExecutor |
getExecutor() |
BrokerInfo[] |
getPeerBrokerInfos()
Get the BrokerInfo's of any connected Brokers
|
TransactionId[] |
getPreparedTransactions(ConnectionContext context)
Gets a list of all the prepared xa transactions.
|
Region |
getQueueRegion() |
Region |
getRegion(ActiveMQDestination destination) |
Broker |
getRoot()
Ensure we get the Broker at the top of the Stack
|
Scheduler |
getScheduler() |
PListStore |
getTempDataStore() |
Region |
getTempQueueRegion() |
Region |
getTempTopicRegion() |
Region |
getTopicRegion() |
URI |
getVmConnectorURI() |
boolean |
isAllowTempAutoCreationOnSend() |
protected boolean |
isEqual(ConnectionId connectionId,
ConnectionId connectionId2) |
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 broker
|
boolean |
isKeepDurableSubsActive() |
boolean |
isStopped() |
void |
messageExpired(ConnectionContext context,
MessageReference node,
Subscription subscription)
A Message has Expired
|
Response |
messagePull(ConnectionContext context,
MessagePull pull)
Allows a consumer to pull a message from a queue
|
void |
postProcessDispatch(MessageDispatch messageDispatch)
Notify the Broker that a dispatch has happened
|
int |
prepareTransaction(ConnectionContext context,
TransactionId xid)
Prepares a transaction.
|
void |
preProcessDispatch(MessageDispatch messageDispatch)
Notify the Broker that a dispatch is going to happen
|
void |
processConsumerControl(ConsumerBrokerExchange consumerExchange,
ConsumerControl control) |
void |
processDispatchNotification(MessageDispatchNotification messageDispatchNotification)
Process a notification of a dispatch - used by a Slave Broker
|
protected void |
purgeInactiveDestinations() |
void |
reapplyInterceptor() |
void |
removeBroker(Connection connection,
BrokerInfo info)
Remove a BrokerInfo
|
protected void |
removeBrokerInClusterUpdate(BrokerInfo info) |
void |
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 object
|
void |
removeProducer(ConnectionContext context,
ProducerInfo info)
Removes a producer.
|
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 node,
Subscription subscription,
Throwable poisonCause)
A message needs to go the a DLQ
|
void |
setAdminConnectionContext(ConnectionContext adminConnectionContext)
Sets the default administration connection context used when configuring
the broker on startup or via JMX
|
void |
setAllowTempAutoCreationOnSend(boolean allowTempAutoCreationOnSend) |
void |
setBrokerId(BrokerId brokerId) |
void |
setBrokerName(String brokerName) |
void |
setKeepDurableSubsActive(boolean keepDurableSubsActive) |
void |
start() |
void |
stop() |
addSession, fastProducer, getAdaptor, isFaultTolerantConfiguration, isFull, messageConsumed, messageDelivered, messageDiscarded, networkBridgeStarted, networkBridgeStopped, nowMasterBroker, removeSession, slowConsumer, virtualDestinationAdded, virtualDestinationRemoved
public static final String ORIGINAL_EXPIRATION
protected final DestinationStatistics destinationStatistics
protected DestinationFactory destinationFactory
protected final Map<ConnectionId,ConnectionState> connectionStates
protected final BrokerService brokerService
public RegionBroker(BrokerService brokerService, TaskRunnerFactory taskRunnerFactory, SystemUsage memoryManager, DestinationFactory destinationFactory, DestinationInterceptor destinationInterceptor, Scheduler scheduler, ThreadPoolExecutor executor) throws IOException
IOException
public Map<ActiveMQDestination,Destination> getDestinationMap()
Region
getDestinationMap
in interface Region
getDestinationMap
in class EmptyBroker
public Map<ActiveMQDestination,Destination> getDestinationMap(ActiveMQDestination destination)
Broker
getDestinationMap
in interface Broker
getDestinationMap
in class EmptyBroker
public Set<Destination> getDestinations(ActiveMQDestination destination)
Region
getDestinations
in interface Region
getDestinations
in class EmptyBroker
public Region getQueueRegion()
public Region getTempQueueRegion()
public Region getTempTopicRegion()
public Region getTopicRegion()
protected Region createTempTopicRegion(SystemUsage memoryManager, TaskRunnerFactory taskRunnerFactory, DestinationFactory destinationFactory)
protected Region createTempQueueRegion(SystemUsage memoryManager, TaskRunnerFactory taskRunnerFactory, DestinationFactory destinationFactory)
protected Region createTopicRegion(SystemUsage memoryManager, TaskRunnerFactory taskRunnerFactory, DestinationFactory destinationFactory)
protected Region createQueueRegion(SystemUsage memoryManager, TaskRunnerFactory taskRunnerFactory, DestinationFactory destinationFactory)
public void start() throws Exception
start
in interface Service
start
in class EmptyBroker
Exception
public void stop() throws Exception
stop
in interface Service
stop
in class EmptyBroker
Exception
public PolicyMap getDestinationPolicy()
public ConnectionContext getConnectionContext(String clientId)
public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception
Broker
addConnection
in interface Broker
addConnection
in class EmptyBroker
Exception
- TODOpublic void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception
Broker
removeConnection
in interface Broker
removeConnection
in class EmptyBroker
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.Exception
- TODOprotected boolean isEqual(ConnectionId connectionId, ConnectionId connectionId2)
public Connection[] getClients() throws Exception
getClients
in interface Broker
getClients
in class EmptyBroker
Exception
- TODOpublic Destination addDestination(ConnectionContext context, ActiveMQDestination destination, boolean createIfTemp) throws Exception
Region
addDestination
in interface Region
addDestination
in class EmptyBroker
destination
- the destination to create.Exception
- TODOpublic void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout) throws Exception
Region
removeDestination
in interface Region
removeDestination
in class EmptyBroker
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 quiesceException
- TODOpublic void addDestinationInfo(ConnectionContext context, DestinationInfo info) throws Exception
Broker
addDestinationInfo
in interface Broker
addDestinationInfo
in class EmptyBroker
Exception
public void removeDestinationInfo(ConnectionContext context, DestinationInfo info) throws Exception
Broker
removeDestinationInfo
in interface Broker
removeDestinationInfo
in class EmptyBroker
Exception
public ActiveMQDestination[] getDestinations() throws Exception
getDestinations
in interface Broker
getDestinations
in class EmptyBroker
Exception
- TODOpublic void addProducer(ConnectionContext context, ProducerInfo info) throws Exception
Broker
addProducer
in interface Broker
addProducer
in interface Region
addProducer
in class EmptyBroker
context
- the environment the operation is being executed under.Exception
- TODOpublic void removeProducer(ConnectionContext context, ProducerInfo info) throws Exception
Broker
removeProducer
in interface Broker
removeProducer
in interface Region
removeProducer
in class EmptyBroker
context
- the environment the operation is being executed under.Exception
- TODOpublic Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception
Region
addConsumer
in interface Region
addConsumer
in class EmptyBroker
context
- the environment the operation is being executed under.Exception
- TODOpublic void removeConsumer(ConnectionContext context, ConsumerInfo info) throws Exception
Region
removeConsumer
in interface Region
removeConsumer
in class EmptyBroker
context
- the environment the operation is being executed under.Exception
- TODOpublic void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception
Region
removeSubscription
in interface Region
removeSubscription
in class EmptyBroker
context
- the environment the operation is being executed under.info
- TODOException
- TODOpublic void send(ProducerBrokerExchange producerExchange, Message message) throws Exception
Region
send
in interface Region
send
in class EmptyBroker
producerExchange
- the environment the operation is being executed under.Exception
- TODOpublic void acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack) throws Exception
Region
acknowledge
in interface Region
acknowledge
in class EmptyBroker
consumerExchange
- the environment the operation is being executed under.Exception
- TODOpublic Region getRegion(ActiveMQDestination destination) throws javax.jms.JMSException
javax.jms.JMSException
public Response messagePull(ConnectionContext context, MessagePull pull) throws Exception
Region
messagePull
in interface Region
messagePull
in class EmptyBroker
Exception
public TransactionId[] getPreparedTransactions(ConnectionContext context) throws Exception
Broker
getPreparedTransactions
in interface Broker
getPreparedTransactions
in class EmptyBroker
context
- transaction idsException
- TODOpublic void beginTransaction(ConnectionContext context, TransactionId xid) throws Exception
Broker
beginTransaction
in interface Broker
beginTransaction
in class EmptyBroker
Exception
- TODOpublic int prepareTransaction(ConnectionContext context, TransactionId xid) throws Exception
Broker
prepareTransaction
in interface Broker
prepareTransaction
in class EmptyBroker
Exception
- TODOpublic void rollbackTransaction(ConnectionContext context, TransactionId xid) throws Exception
Broker
rollbackTransaction
in interface Broker
rollbackTransaction
in class EmptyBroker
Exception
- TODOpublic void commitTransaction(ConnectionContext context, TransactionId xid, boolean onePhase) throws Exception
Broker
commitTransaction
in interface Broker
commitTransaction
in class EmptyBroker
Exception
- TODOpublic void forgetTransaction(ConnectionContext context, TransactionId transactionId) throws Exception
Broker
forgetTransaction
in interface Broker
forgetTransaction
in class EmptyBroker
Exception
public void gc()
gc
in interface Region
gc
in class EmptyBroker
public BrokerId getBrokerId()
Broker
getBrokerId
in interface Broker
getBrokerId
in class EmptyBroker
public void setBrokerId(BrokerId brokerId)
public String getBrokerName()
Broker
getBrokerName
in interface Broker
getBrokerName
in class EmptyBroker
public void setBrokerName(String brokerName)
public DestinationStatistics getDestinationStatistics()
protected javax.jms.JMSException createUnknownDestinationTypeException(ActiveMQDestination destination)
public void addBroker(Connection connection, BrokerInfo info)
Broker
addBroker
in interface Broker
addBroker
in class EmptyBroker
public void removeBroker(Connection connection, BrokerInfo info)
Broker
removeBroker
in interface Broker
removeBroker
in class EmptyBroker
public BrokerInfo[] getPeerBrokerInfos()
Broker
getPeerBrokerInfos
in interface Broker
getPeerBrokerInfos
in class EmptyBroker
public void preProcessDispatch(MessageDispatch messageDispatch)
Broker
preProcessDispatch
in interface Broker
preProcessDispatch
in class EmptyBroker
public void postProcessDispatch(MessageDispatch messageDispatch)
Broker
postProcessDispatch
in interface Broker
postProcessDispatch
in class EmptyBroker
public void processDispatchNotification(MessageDispatchNotification messageDispatchNotification) throws Exception
Region
processDispatchNotification
in interface Region
processDispatchNotification
in class EmptyBroker
Exception
- TODOpublic boolean isStopped()
isStopped
in interface Broker
isStopped
in class EmptyBroker
public Set<ActiveMQDestination> getDurableDestinations()
getDurableDestinations
in interface Broker
getDurableDestinations
in class EmptyBroker
protected void doStop(ServiceStopper ss)
public boolean isKeepDurableSubsActive()
public void setKeepDurableSubsActive(boolean keepDurableSubsActive)
public DestinationInterceptor getDestinationInterceptor()
public ConnectionContext getAdminConnectionContext()
getAdminConnectionContext
in interface Broker
getAdminConnectionContext
in class EmptyBroker
public void setAdminConnectionContext(ConnectionContext adminConnectionContext)
Broker
setAdminConnectionContext
in interface Broker
setAdminConnectionContext
in class EmptyBroker
public Map<ConnectionId,ConnectionState> getConnectionStates()
public PListStore getTempDataStore()
getTempDataStore
in interface Broker
getTempDataStore
in class EmptyBroker
public URI getVmConnectorURI()
getVmConnectorURI
in interface Broker
getVmConnectorURI
in class EmptyBroker
public void brokerServiceStarted()
Broker
brokerServiceStarted
in interface Broker
brokerServiceStarted
in class EmptyBroker
public BrokerService getBrokerService()
getBrokerService
in interface Broker
getBrokerService
in class EmptyBroker
public boolean isExpired(MessageReference messageReference)
Broker
isExpired
in interface Broker
isExpired
in class EmptyBroker
public void messageExpired(ConnectionContext context, MessageReference node, Subscription subscription)
Broker
messageExpired
in interface Broker
messageExpired
in class EmptyBroker
subscription
- (may be null)public boolean sendToDeadLetterQueue(ConnectionContext context, MessageReference node, Subscription subscription, Throwable poisonCause)
Broker
sendToDeadLetterQueue
in interface Broker
sendToDeadLetterQueue
in class EmptyBroker
poisonCause
- reason for dlq submission, may be nullpublic Broker getRoot()
Broker
getRoot
in interface Broker
getRoot
in class EmptyBroker
public long getBrokerSequenceId()
getBrokerSequenceId
in interface Broker
getBrokerSequenceId
in class EmptyBroker
public Scheduler getScheduler()
getScheduler
in interface Broker
getScheduler
in class EmptyBroker
public ThreadPoolExecutor getExecutor()
getExecutor
in interface Broker
getExecutor
in class EmptyBroker
public void processConsumerControl(ConsumerBrokerExchange consumerExchange, ConsumerControl control)
processConsumerControl
in interface Region
processConsumerControl
in class EmptyBroker
protected void addBrokerInClusterUpdate(BrokerInfo info)
protected void removeBrokerInClusterUpdate(BrokerInfo info)
protected void purgeInactiveDestinations()
public boolean isAllowTempAutoCreationOnSend()
public void setAllowTempAutoCreationOnSend(boolean allowTempAutoCreationOnSend)
public void reapplyInterceptor()
reapplyInterceptor
in interface Region
reapplyInterceptor
in class EmptyBroker
Copyright © 2005–2019 The Apache Software Foundation. All rights reserved.