Package org.apache.activemq.partition
Class PartitionBroker
- java.lang.Object
-
- org.apache.activemq.broker.BrokerFilter
-
- org.apache.activemq.partition.PartitionBroker
-
- Direct Known Subclasses:
ZooKeeperPartitionBroker
public class PartitionBroker extends BrokerFilter
A BrokerFilter which partitions client connections over a cluster of brokers. It can use a client identifier like client id, authenticated user name, source ip address or even destination being used by the connection to figure out which is the best broker in the cluster that the connection should be using and then redirects failover clients to that broker.
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.LoggerLOGprotected ConcurrentMap<ConnectionId,org.apache.activemq.partition.PartitionBroker.ConnectionMonitor>monitorsprotected PartitionBrokerPluginpluginprotected booleanreloadConfigOnPoll-
Fields inherited from class org.apache.activemq.broker.BrokerFilter
next
-
-
Constructor Summary
Constructors Constructor Description PartitionBroker(Broker broker, PartitionBrokerPlugin plugin)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConnection(ConnectionContext context, ConnectionInfo info)A client is establishing a connection with the broker.protected voidcheckTarget(org.apache.activemq.partition.PartitionBroker.ConnectionMonitor monitor)protected PartitioninggetConfig()protected StringgetConnectionString(HashSet<String> ids)protected TargetgetTarget(ActiveMQDestination dest)protected voidmonitorWait()protected voidmonitorWakeup()protected voidonMonitorStart()protected voidonMonitorStop()protected TargetpickBestBroker(org.apache.activemq.partition.PartitionBroker.ConnectionMonitor monitor)protected voidreloadConfiguration()voidremoveConnection(ConnectionContext context, ConnectionInfo info, Throwable error)A client is disconnecting from the broker.protected voidrunPartitionMonitor()voidsend(ProducerBrokerExchange producerExchange, Message messageSend)Send a message to the broker to using the specified destination.voidstart()-
Methods inherited from class org.apache.activemq.broker.BrokerFilter
acknowledge, addBroker, addConsumer, addDestination, addDestinationInfo, addProducer, addSession, beginTransaction, brokerServiceStarted, commitTransaction, fastProducer, forgetTransaction, gc, getAdaptor, getAdminConnectionContext, getBrokerId, getBrokerName, getBrokerSequenceId, getBrokerService, getClients, getDestinationMap, getDestinationMap, getDestinations, getDestinations, getDurableDestinations, getExecutor, getNext, getPeerBrokerInfos, getPreparedTransactions, getRoot, getScheduler, getTempDataStore, getVmConnectorURI, isExpired, isFaultTolerantConfiguration, isFull, isStopped, messageConsumed, messageDelivered, messageDiscarded, messageExpired, messagePull, networkBridgeStarted, networkBridgeStopped, nowMasterBroker, postProcessDispatch, prepareTransaction, preProcessDispatch, processConsumerControl, processDispatchNotification, reapplyInterceptor, removeBroker, removeConsumer, removeDestination, removeDestinationInfo, removeProducer, removeSession, removeSubscription, rollbackTransaction, sendToDeadLetterQueue, setAdminConnectionContext, slowConsumer, stop, virtualDestinationAdded, virtualDestinationRemoved
-
-
-
-
Field Detail
-
LOG
protected static final org.slf4j.Logger LOG
-
plugin
protected final PartitionBrokerPlugin plugin
-
reloadConfigOnPoll
protected boolean reloadConfigOnPoll
-
monitors
protected final ConcurrentMap<ConnectionId,org.apache.activemq.partition.PartitionBroker.ConnectionMonitor> monitors
-
-
Constructor Detail
-
PartitionBroker
public PartitionBroker(Broker broker, PartitionBrokerPlugin plugin)
-
-
Method Detail
-
start
public void start() throws Exception- Specified by:
startin interfaceService- Overrides:
startin classBrokerFilter- Throws:
Exception
-
onMonitorStart
protected void onMonitorStart()
-
onMonitorStop
protected void onMonitorStop()
-
runPartitionMonitor
protected void runPartitionMonitor()
-
monitorWait
protected void monitorWait() throws InterruptedException- Throws:
InterruptedException
-
monitorWakeup
protected void monitorWakeup()
-
checkTarget
protected void checkTarget(org.apache.activemq.partition.PartitionBroker.ConnectionMonitor monitor)
-
pickBestBroker
protected Target pickBestBroker(org.apache.activemq.partition.PartitionBroker.ConnectionMonitor monitor)
-
getTarget
protected Target getTarget(ActiveMQDestination dest)
-
addConnection
public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception
Description copied from interface:BrokerA client is establishing a connection with the broker.- Specified by:
addConnectionin interfaceBroker- Overrides:
addConnectionin classBrokerFilter- Throws:
Exception- TODO
-
removeConnection
public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception
Description copied from interface:BrokerA client is disconnecting from the broker.- Specified by:
removeConnectionin interfaceBroker- Overrides:
removeConnectionin classBrokerFilter- 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
-
send
public void send(ProducerBrokerExchange producerExchange, Message messageSend) throws Exception
Description copied from interface:RegionSend 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.- Specified by:
sendin interfaceRegion- Overrides:
sendin classBrokerFilter- Parameters:
producerExchange- the environment the operation is being executed under.- Throws:
Exception- TODO
-
getConfig
protected Partitioning getConfig()
-
-