org.apache.activemq.broker.ft
Class MasterBroker

java.lang.Object
  extended by org.apache.activemq.broker.MutableBrokerFilter
      extended by org.apache.activemq.broker.InsertableMutableBrokerFilter
          extended by org.apache.activemq.broker.ft.MasterBroker
All Implemented Interfaces:
Broker, Region, Service

public class MasterBroker
extends InsertableMutableBrokerFilter

The Message Broker which passes messages to a slave


Field Summary
 
Fields inherited from class org.apache.activemq.broker.MutableBrokerFilter
next
 
Constructor Summary
MasterBroker(MutableBrokerFilter parent, Transport transport)
          Constructor
 
Method Summary
 void acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack)
          Used to acknowledge the receipt of a message by a client.
 void addConnection(ConnectionContext context, ConnectionInfo info)
          A client is establishing a connection with the broker.
 Subscription addConsumer(ConnectionContext context, ConsumerInfo info)
          add a consumer
 void addDestinationInfo(ConnectionContext context, DestinationInfo info)
          Add and process a DestinationInfo object
 void addProducer(ConnectionContext context, ProducerInfo info)
          Adds a producer.
 void addSession(ConnectionContext context, SessionInfo info)
          Adds a session.
 void beginTransaction(ConnectionContext context, TransactionId xid)
          begin a transaction
 void commitTransaction(ConnectionContext context, TransactionId xid, boolean onePhase)
          Commits a transaction.
 void forgetTransaction(ConnectionContext context, TransactionId xid)
          Forgets a transaction.
 boolean isFaultTolerantConfiguration()
           
 int prepareTransaction(ConnectionContext context, TransactionId xid)
          Prepares a transaction.
 void preProcessDispatch(MessageDispatch messageDispatch)
          Notifiy the Broker that a dispatch will happen Do in 'pre' so that slave will avoid getting ack before dispatch similar logic to send() below.
 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 removeDestinationInfo(ConnectionContext context, DestinationInfo info)
          Remove and process a DestinationInfo object
 void removeProducer(ConnectionContext context, ProducerInfo info)
          Removes a producer.
 void removeSession(ConnectionContext context, SessionInfo info)
          Removes a session.
 void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info)
          remove a 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.
protected  void sendAsyncToSlave(Command command)
           
protected  void sendSyncToSlave(Command command)
           
protected  void sendToSlave(Message message)
           
protected  void sendToSlave(MessageAck ack)
           
 void startProcessing()
          start processing this broker
 void stop()
          stop the broker
 void stopProcessing()
          stop processing this broker
 
Methods inherited from class org.apache.activemq.broker.InsertableMutableBrokerFilter
remove
 
Methods inherited from class org.apache.activemq.broker.MutableBrokerFilter
addBroker, addDestination, brokerServiceStarted, fastProducer, gc, getAdaptor, getAdminConnectionContext, getBrokerId, getBrokerName, getBrokerSequenceId, getBrokerService, getClients, getDestinationMap, getDestinations, getDestinations, getDurableDestinations, getExecutor, getNext, getPeerBrokerInfos, getPreparedTransactions, getRoot, getScheduler, getTempDataStore, getVmConnectorURI, isExpired, isFull, isStopped, messageConsumed, messageDelivered, messageDiscarded, messageExpired, messagePull, networkBridgeStarted, networkBridgeStopped, nowMasterBroker, postProcessDispatch, processConsumerControl, processDispatchNotification, removeBroker, removeDestination, sendToDeadLetterQueue, setAdminConnectionContext, setNext, slowConsumer, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MasterBroker

public MasterBroker(MutableBrokerFilter parent,
                    Transport transport)
Constructor

Parameters:
parent -
transport -
Method Detail

startProcessing

public void startProcessing()
start processing this broker


stop

public void stop()
          throws Exception
stop the broker

Specified by:
stop in interface Service
Overrides:
stop in class MutableBrokerFilter
Throws:
Exception

stopProcessing

public void stopProcessing()
stop processing this broker


addConnection

public void addConnection(ConnectionContext context,
                          ConnectionInfo info)
                   throws Exception
A client is establishing a connection with the broker.

Specified by:
addConnection in interface Broker
Overrides:
addConnection in class MutableBrokerFilter
Parameters:
context -
info -
Throws:
Exception

removeConnection

public void removeConnection(ConnectionContext context,
                             ConnectionInfo info,
                             Throwable error)
                      throws Exception
A client is disconnecting from the broker.

Specified by:
removeConnection in interface Broker
Overrides:
removeConnection in class MutableBrokerFilter
Parameters:
context - the environment the operation is being executed under.
info -
error - null if the client requested the disconnect or the error that caused the client to disconnect.
Throws:
Exception

addSession

public void addSession(ConnectionContext context,
                       SessionInfo info)
                throws Exception
Adds a session.

Specified by:
addSession in interface Broker
Overrides:
addSession in class MutableBrokerFilter
Parameters:
context -
info -
Throws:
Exception

removeSession

public void removeSession(ConnectionContext context,
                          SessionInfo info)
                   throws Exception
Removes a session.

Specified by:
removeSession in interface Broker
Overrides:
removeSession in class MutableBrokerFilter
Parameters:
context -
info -
Throws:
Exception

addProducer

public void addProducer(ConnectionContext context,
                        ProducerInfo info)
                 throws Exception
Adds a producer.

Specified by:
addProducer in interface Broker
Specified by:
addProducer in interface Region
Overrides:
addProducer in class MutableBrokerFilter
Parameters:
context - the enviorment the operation is being executed under.
info -
Throws:
Exception

removeProducer

public void removeProducer(ConnectionContext context,
                           ProducerInfo info)
                    throws Exception
Removes a producer.

Specified by:
removeProducer in interface Broker
Specified by:
removeProducer in interface Region
Overrides:
removeProducer in class MutableBrokerFilter
Parameters:
context - the environment the operation is being executed under.
info -
Throws:
Exception

addConsumer

public Subscription addConsumer(ConnectionContext context,
                                ConsumerInfo info)
                         throws Exception
add a consumer

Specified by:
addConsumer in interface Region
Overrides:
addConsumer in class MutableBrokerFilter
Parameters:
context -
info -
Returns:
the associated subscription
Throws:
Exception

removeConsumer

public void removeConsumer(ConnectionContext context,
                           ConsumerInfo info)
                    throws Exception
Description copied from interface: Region
Removes a consumer.

Specified by:
removeConsumer in interface Region
Overrides:
removeConsumer in class MutableBrokerFilter
Parameters:
context - the environment the operation is being executed under.
Throws:
Exception - TODO

removeSubscription

public void removeSubscription(ConnectionContext context,
                               RemoveSubscriptionInfo info)
                        throws Exception
remove a subscription

Specified by:
removeSubscription in interface Region
Overrides:
removeSubscription in class MutableBrokerFilter
Parameters:
context -
info -
Throws:
Exception

addDestinationInfo

public void addDestinationInfo(ConnectionContext context,
                               DestinationInfo info)
                        throws Exception
Description copied from interface: Broker
Add and process a DestinationInfo object

Specified by:
addDestinationInfo in interface Broker
Overrides:
addDestinationInfo in class MutableBrokerFilter
Throws:
Exception

removeDestinationInfo

public void removeDestinationInfo(ConnectionContext context,
                                  DestinationInfo info)
                           throws Exception
Description copied from interface: Broker
Remove and process a DestinationInfo object

Specified by:
removeDestinationInfo in interface Broker
Overrides:
removeDestinationInfo in class MutableBrokerFilter
Throws:
Exception

beginTransaction

public void beginTransaction(ConnectionContext context,
                             TransactionId xid)
                      throws Exception
begin a transaction

Specified by:
beginTransaction in interface Broker
Overrides:
beginTransaction in class MutableBrokerFilter
Parameters:
context -
xid -
Throws:
Exception

prepareTransaction

public int prepareTransaction(ConnectionContext context,
                              TransactionId xid)
                       throws Exception
Prepares a transaction. Only valid for xa transactions.

Specified by:
prepareTransaction in interface Broker
Overrides:
prepareTransaction in class MutableBrokerFilter
Parameters:
context -
xid -
Returns:
the state
Throws:
Exception

rollbackTransaction

public void rollbackTransaction(ConnectionContext context,
                                TransactionId xid)
                         throws Exception
Rollsback a transaction.

Specified by:
rollbackTransaction in interface Broker
Overrides:
rollbackTransaction in class MutableBrokerFilter
Parameters:
context -
xid -
Throws:
Exception

commitTransaction

public void commitTransaction(ConnectionContext context,
                              TransactionId xid,
                              boolean onePhase)
                       throws Exception
Commits a transaction.

Specified by:
commitTransaction in interface Broker
Overrides:
commitTransaction in class MutableBrokerFilter
Parameters:
context -
xid -
onePhase -
Throws:
Exception

forgetTransaction

public void forgetTransaction(ConnectionContext context,
                              TransactionId xid)
                       throws Exception
Forgets a transaction.

Specified by:
forgetTransaction in interface Broker
Overrides:
forgetTransaction in class MutableBrokerFilter
Parameters:
context -
xid -
Throws:
Exception

preProcessDispatch

public void preProcessDispatch(MessageDispatch messageDispatch)
Notifiy the Broker that a dispatch will happen Do in 'pre' so that slave will avoid getting ack before dispatch similar logic to send() below.

Specified by:
preProcessDispatch in interface Broker
Overrides:
preProcessDispatch in class MutableBrokerFilter
Parameters:
messageDispatch -

send

public void send(ProducerBrokerExchange producerExchange,
                 Message message)
          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 interface Region
Overrides:
send in class MutableBrokerFilter
Parameters:
context -
message -
Throws:
Exception

acknowledge

public void acknowledge(ConsumerBrokerExchange consumerExchange,
                        MessageAck ack)
                 throws Exception
Description copied from interface: Region
Used to acknowledge the receipt of a message by a client.

Specified by:
acknowledge in interface Region
Overrides:
acknowledge in class MutableBrokerFilter
Parameters:
context -
ack -
Throws:
Exception

isFaultTolerantConfiguration

public boolean isFaultTolerantConfiguration()
Specified by:
isFaultTolerantConfiguration in interface Broker
Overrides:
isFaultTolerantConfiguration in class MutableBrokerFilter
Returns:
true if fault tolerant

sendToSlave

protected void sendToSlave(Message message)

sendToSlave

protected void sendToSlave(MessageAck ack)

sendAsyncToSlave

protected void sendAsyncToSlave(Command command)

sendSyncToSlave

protected void sendSyncToSlave(Command command)


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