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.Logger
LOG
protected ConcurrentMap<ConnectionId,org.apache.activemq.partition.PartitionBroker.ConnectionMonitor>
monitors
protected PartitionBrokerPlugin
plugin
protected boolean
reloadConfigOnPoll
-
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 void
addConnection(ConnectionContext context, ConnectionInfo info)
A client is establishing a connection with the broker.protected void
checkTarget(org.apache.activemq.partition.PartitionBroker.ConnectionMonitor monitor)
protected Partitioning
getConfig()
protected String
getConnectionString(HashSet<String> ids)
protected Target
getTarget(ActiveMQDestination dest)
protected void
monitorWait()
protected void
monitorWakeup()
protected void
onMonitorStart()
protected void
onMonitorStop()
protected Target
pickBestBroker(org.apache.activemq.partition.PartitionBroker.ConnectionMonitor monitor)
protected void
reloadConfiguration()
void
removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error)
A client is disconnecting from the broker.protected void
runPartitionMonitor()
void
send(ProducerBrokerExchange producerExchange, Message messageSend)
Send a message to the broker to using the specified destination.void
start()
-
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:
start
in interfaceService
- Overrides:
start
in 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:Broker
A client is establishing a connection with the broker.- Specified by:
addConnection
in interfaceBroker
- Overrides:
addConnection
in classBrokerFilter
- 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
- Overrides:
removeConnection
in 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: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.- Specified by:
send
in interfaceRegion
- Overrides:
send
in classBrokerFilter
- Parameters:
producerExchange
- the environment the operation is being executed under.- Throws:
Exception
- TODO
-
getConfig
protected Partitioning getConfig()
-
-