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<org.apache.activemq.command.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, org.apache.activemq.command.ConnectionInfo info)protected voidcheckTarget(org.apache.activemq.partition.PartitionBroker.ConnectionMonitor monitor)protected PartitioninggetConfig()protected StringgetConnectionString(HashSet<String> ids)protected TargetgetTarget(org.apache.activemq.command.ActiveMQDestination dest)protected voidmonitorWait()protected voidmonitorWakeup()protected voidonMonitorStart()protected voidonMonitorStop()protected TargetpickBestBroker(org.apache.activemq.partition.PartitionBroker.ConnectionMonitor monitor)protected voidreloadConfiguration()voidremoveConnection(ConnectionContext context, org.apache.activemq.command.ConnectionInfo info, Throwable error)protected voidrunPartitionMonitor()voidsend(ProducerBrokerExchange producerExchange, org.apache.activemq.command.Message messageSend)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<org.apache.activemq.command.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 interfaceorg.apache.activemq.Service- 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(org.apache.activemq.command.ActiveMQDestination dest)
-
addConnection
public void addConnection(ConnectionContext context, org.apache.activemq.command.ConnectionInfo info) throws Exception
- Specified by:
addConnectionin interfaceBroker- Overrides:
addConnectionin classBrokerFilter- Throws:
Exception
-
removeConnection
public void removeConnection(ConnectionContext context, org.apache.activemq.command.ConnectionInfo info, Throwable error) throws Exception
- Specified by:
removeConnectionin interfaceBroker- Overrides:
removeConnectionin classBrokerFilter- Throws:
Exception
-
send
public void send(ProducerBrokerExchange producerExchange, org.apache.activemq.command.Message messageSend) throws Exception
- Specified by:
sendin interfaceRegion- Overrides:
sendin classBrokerFilter- Throws:
Exception
-
getConfig
protected Partitioning getConfig()
-
-