org.apache.activemq.partition
Class PartitionBroker

java.lang.Object
  extended by org.apache.activemq.broker.BrokerFilter
      extended by org.apache.activemq.partition.PartitionBroker
All Implemented Interfaces:
Broker, Region, org.apache.activemq.Service
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
protected static org.slf4j.Logger LOG
           
protected  ConcurrentHashMap<org.apache.activemq.command.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
PartitionBroker(Broker broker, PartitionBrokerPlugin plugin)
           
 
Method Summary
 void addConnection(ConnectionContext context, org.apache.activemq.command.ConnectionInfo info)
           
protected  void checkTarget(org.apache.activemq.partition.PartitionBroker.ConnectionMonitor monitor)
           
protected  Partitioning getConfig()
           
protected  String getConnectionString(HashSet<String> ids)
           
protected  Target getTarget(org.apache.activemq.command.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, org.apache.activemq.command.ConnectionInfo info, Throwable error)
           
protected  void runPartitionMonitor()
           
 void send(ProducerBrokerExchange producerExchange, org.apache.activemq.command.Message messageSend)
           
 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, getDestinations, getDestinations, getDurableDestinations, getExecutor, getPeerBrokerInfos, getPreparedTransactions, getRoot, getScheduler, getTempDataStore, getVmConnectorURI, isExpired, isFaultTolerantConfiguration, isFull, isStopped, messageConsumed, messageDelivered, messageDiscarded, messageExpired, messagePull, networkBridgeStarted, networkBridgeStopped, nowMasterBroker, postProcessDispatch, prepareTransaction, preProcessDispatch, processConsumerControl, processDispatchNotification, removeBroker, removeConsumer, removeDestination, removeDestinationInfo, removeProducer, removeSession, removeSubscription, rollbackTransaction, sendToDeadLetterQueue, setAdminConnectionContext, slowConsumer, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.slf4j.Logger LOG

plugin

protected final PartitionBrokerPlugin plugin

reloadConfigOnPoll

protected boolean reloadConfigOnPoll

monitors

protected final ConcurrentHashMap<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:
start in interface org.apache.activemq.Service
Overrides:
start in class BrokerFilter
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()

reloadConfiguration

protected void reloadConfiguration()
                            throws Exception
Throws:
Exception

checkTarget

protected void checkTarget(org.apache.activemq.partition.PartitionBroker.ConnectionMonitor monitor)

getConnectionString

protected String getConnectionString(HashSet<String> ids)

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:
addConnection in interface Broker
Overrides:
addConnection in class BrokerFilter
Throws:
Exception

removeConnection

public void removeConnection(ConnectionContext context,
                             org.apache.activemq.command.ConnectionInfo info,
                             Throwable error)
                      throws Exception
Specified by:
removeConnection in interface Broker
Overrides:
removeConnection in class BrokerFilter
Throws:
Exception

send

public void send(ProducerBrokerExchange producerExchange,
                 org.apache.activemq.command.Message messageSend)
          throws Exception
Specified by:
send in interface Region
Overrides:
send in class BrokerFilter
Throws:
Exception

getConfig

protected Partitioning getConfig()


Copyright © 2005-2013 The Apache Software Foundation. All Rights Reserved.