org.apache.activemq.broker
Interface Broker

All Superinterfaces:
Region, Service
All Known Implementing Classes:
AdvisoryBroker, AuthorizationBroker, BrokerBroadcaster, BrokerFilter, BrokerPluginSupport, CompositeDestinationBroker, ConnectionDotFileInterceptor, ConnectionSplitBroker, DestinationDotFileInterceptor, DestinationPathSeparatorBroker, DiscardingDLQBroker, DotFileInterceptorSupport, EmptyBroker, ErrorBroker, ForcePersistencyModeBroker, InsertableMutableBrokerFilter, JaasAuthenticationBroker, JaasCertificateAuthenticationBroker, JaasDualAuthenticationBroker, LoggingBrokerPlugin, ManagedRegionBroker, MasterBroker, MulticastTraceBrokerPlugin, MutableBrokerFilter, RedeliveryPlugin, RegionBroker, SchedulerBroker, SimpleAuthenticationBroker, StatisticsBroker, SubQueueSelectorCacheBroker, TimeStampingBrokerPlugin, TraceBrokerPathPlugin, TransactionBroker, UDPTraceBrokerPlugin, UserIDBroker

public interface Broker
extends Region, Service

The Message Broker which routes messages, maintains subscriptions and connections, acknowledges messages and handles transactions.


Method Summary
 void addBroker(Connection connection, BrokerInfo info)
          A remote Broker connects
 void addConnection(ConnectionContext context, ConnectionInfo info)
          A client is establishing a connection with the broker.
 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)
          Starts a transaction.
 void brokerServiceStarted()
          called when the brokerService starts
 void commitTransaction(ConnectionContext context, TransactionId xid, boolean onePhase)
          Commits a transaction.
 void fastProducer(ConnectionContext context, ProducerInfo producerInfo, ActiveMQDestination destination)
          Called to notify a producer is too fast
 void forgetTransaction(ConnectionContext context, TransactionId transactionId)
          Forgets a transaction.
 Broker getAdaptor(Class type)
          Get a Broker from the Broker Stack that is a particular class
 ConnectionContext getAdminConnectionContext()
           
 BrokerId getBrokerId()
          Get the id of the broker
 String getBrokerName()
          Get the name of the broker
 long getBrokerSequenceId()
           
 BrokerService getBrokerService()
           
 Connection[] getClients()
           
 ActiveMQDestination[] getDestinations()
           
 Set<ActiveMQDestination> getDurableDestinations()
           
 ThreadPoolExecutor getExecutor()
           
 BrokerInfo[] getPeerBrokerInfos()
          Get the BrokerInfo's of any connected Brokers
 TransactionId[] getPreparedTransactions(ConnectionContext context)
          Gets a list of all the prepared xa transactions.
 Broker getRoot()
          Ensure we get the Broker at the top of the Stack
 Scheduler getScheduler()
           
 PListStore getTempDataStore()
           
 URI getVmConnectorURI()
           
 boolean isExpired(MessageReference messageReference)
          Determine if a message has expired -allows default behaviour to be overriden - as the timestamp set by the producer can be out of sync with the broker
 boolean isFaultTolerantConfiguration()
           
 void isFull(ConnectionContext context, Destination destination, Usage usage)
          Called when a Usage reaches a limit
 boolean isStopped()
           
 void messageConsumed(ConnectionContext context, MessageReference messageReference)
          called when message is consumed
 void messageDelivered(ConnectionContext context, MessageReference messageReference)
          Called when message is delivered to the broker
 void messageDiscarded(ConnectionContext context, Subscription sub, MessageReference messageReference)
          Called when a message is discarded - e.g.
 void messageExpired(ConnectionContext context, MessageReference messageReference, Subscription subscription)
          A Message has Expired
 void networkBridgeStarted(BrokerInfo brokerInfo, boolean createdByDuplex, String remoteIp)
           
 void networkBridgeStopped(BrokerInfo brokerInfo)
           
 void nowMasterBroker()
          called when the broker becomes the master in a master/slave configuration
 void postProcessDispatch(MessageDispatch messageDispatch)
          Notify the Broker that a dispatch has happened
 int prepareTransaction(ConnectionContext context, TransactionId xid)
          Prepares a transaction.
 void preProcessDispatch(MessageDispatch messageDispatch)
          Notify the Broker that a dispatch is going to happen
 void removeBroker(Connection connection, BrokerInfo info)
          Remove a BrokerInfo
 void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error)
          A client is disconnecting from the broker.
 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 rollbackTransaction(ConnectionContext context, TransactionId xid)
          Rollsback a transaction.
 void sendToDeadLetterQueue(ConnectionContext context, MessageReference messageReference, Subscription subscription)
          A message needs to go the a DLQ
 void setAdminConnectionContext(ConnectionContext adminConnectionContext)
          Sets the default administration connection context used when configuring the broker on startup or via JMX
 void slowConsumer(ConnectionContext context, Destination destination, Subscription subs)
          Called when there is a slow consumer
 
Methods inherited from interface org.apache.activemq.broker.region.Region
acknowledge, addConsumer, addDestination, gc, getDestinationMap, getDestinations, messagePull, processConsumerControl, processDispatchNotification, removeConsumer, removeDestination, removeSubscription, send
 
Methods inherited from interface org.apache.activemq.Service
start, stop
 

Method Detail

getAdaptor

Broker getAdaptor(Class type)
Get a Broker from the Broker Stack that is a particular class

Parameters:
type -
Returns:

getBrokerId

BrokerId getBrokerId()
Get the id of the broker


getBrokerName

String getBrokerName()
Get the name of the broker


addBroker

void addBroker(Connection connection,
               BrokerInfo info)
A remote Broker connects


removeBroker

void removeBroker(Connection connection,
                  BrokerInfo info)
Remove a BrokerInfo

Parameters:
connection -
info -

addConnection

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

Throws:
Exception - TODO

removeConnection

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

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 - TODO

addSession

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

Parameters:
context -
info -
Throws:
Exception - TODO

removeSession

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

Parameters:
context -
info -
Throws:
Exception - TODO

addProducer

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

Specified by:
addProducer in interface Region
Parameters:
context - the enviorment the operation is being executed under.
Throws:
Exception - TODO

removeProducer

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

Specified by:
removeProducer in interface Region
Parameters:
context - the enviorment the operation is being executed under.
Throws:
Exception - TODO

getClients

Connection[] getClients()
                        throws Exception
Returns:
all clients added to the Broker.
Throws:
Exception - TODO

getDestinations

ActiveMQDestination[] getDestinations()
                                      throws Exception
Returns:
all destinations added to the Broker.
Throws:
Exception - TODO

getPreparedTransactions

TransactionId[] getPreparedTransactions(ConnectionContext context)
                                        throws Exception
Gets a list of all the prepared xa transactions.

Parameters:
context - transaction ids
Returns:
Throws:
Exception - TODO

beginTransaction

void beginTransaction(ConnectionContext context,
                      TransactionId xid)
                      throws Exception
Starts a transaction.

Parameters:
context -
xid -
Throws:
Exception - TODO

prepareTransaction

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

Parameters:
context -
xid -
Returns:
id
Throws:
Exception - TODO

rollbackTransaction

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

Parameters:
context -
xid -
Throws:
Exception - TODO

commitTransaction

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

Parameters:
context -
xid -
onePhase -
Throws:
Exception - TODO

forgetTransaction

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

Parameters:
context -
transactionId -
Throws:
Exception

getPeerBrokerInfos

BrokerInfo[] getPeerBrokerInfos()
Get the BrokerInfo's of any connected Brokers

Returns:
array of peer BrokerInfos

preProcessDispatch

void preProcessDispatch(MessageDispatch messageDispatch)
Notify the Broker that a dispatch is going to happen

Parameters:
messageDispatch -

postProcessDispatch

void postProcessDispatch(MessageDispatch messageDispatch)
Notify the Broker that a dispatch has happened

Parameters:
messageDispatch -

isStopped

boolean isStopped()
Returns:
true if the broker has stopped

getDurableDestinations

Set<ActiveMQDestination> getDurableDestinations()
Returns:
a Set of all durable destinations

addDestinationInfo

void addDestinationInfo(ConnectionContext context,
                        DestinationInfo info)
                        throws Exception
Add and process a DestinationInfo object

Parameters:
context -
info -
Throws:
Exception

removeDestinationInfo

void removeDestinationInfo(ConnectionContext context,
                           DestinationInfo info)
                           throws Exception
Remove and process a DestinationInfo object

Parameters:
context -
info -
Throws:
Exception

isFaultTolerantConfiguration

boolean isFaultTolerantConfiguration()
Returns:
true if fault tolerant

getAdminConnectionContext

ConnectionContext getAdminConnectionContext()
Returns:
the connection context used to make administration operations on startup or via JMX MBeans

setAdminConnectionContext

void setAdminConnectionContext(ConnectionContext adminConnectionContext)
Sets the default administration connection context used when configuring the broker on startup or via JMX

Parameters:
adminConnectionContext -

getTempDataStore

PListStore getTempDataStore()
Returns:
the temp data store

getVmConnectorURI

URI getVmConnectorURI()
Returns:
the URI that can be used to connect to the local Broker

brokerServiceStarted

void brokerServiceStarted()
called when the brokerService starts


getBrokerService

BrokerService getBrokerService()
Returns:
the BrokerService

getRoot

Broker getRoot()
Ensure we get the Broker at the top of the Stack

Returns:
the broker at the top of the Stack

isExpired

boolean isExpired(MessageReference messageReference)
Determine if a message has expired -allows default behaviour to be overriden - as the timestamp set by the producer can be out of sync with the broker

Parameters:
messageReference -
Returns:
true if the message is expired

messageExpired

void messageExpired(ConnectionContext context,
                    MessageReference messageReference,
                    Subscription subscription)
A Message has Expired

Parameters:
context -
messageReference -
subscription, - may be null

sendToDeadLetterQueue

void sendToDeadLetterQueue(ConnectionContext context,
                           MessageReference messageReference,
                           Subscription subscription)
A message needs to go the a DLQ

Parameters:
context -
messageReference -
subscription, - may be null

getBrokerSequenceId

long getBrokerSequenceId()
Returns:
the broker sequence id

messageConsumed

void messageConsumed(ConnectionContext context,
                     MessageReference messageReference)
called when message is consumed

Parameters:
context -
messageReference -

messageDelivered

void messageDelivered(ConnectionContext context,
                      MessageReference messageReference)
Called when message is delivered to the broker

Parameters:
context -
messageReference -

messageDiscarded

void messageDiscarded(ConnectionContext context,
                      Subscription sub,
                      MessageReference messageReference)
Called when a message is discarded - e.g. running low on memory This will happen only if the policy is enabled - e.g. non durable topics

Parameters:
context -
sub -
messageReference -

slowConsumer

void slowConsumer(ConnectionContext context,
                  Destination destination,
                  Subscription subs)
Called when there is a slow consumer

Parameters:
context -
destination -
subs -

fastProducer

void fastProducer(ConnectionContext context,
                  ProducerInfo producerInfo,
                  ActiveMQDestination destination)
Called to notify a producer is too fast

Parameters:
context -
producerInfo -
destination -

isFull

void isFull(ConnectionContext context,
            Destination destination,
            Usage usage)
Called when a Usage reaches a limit

Parameters:
context -
destination -
usage -

nowMasterBroker

void nowMasterBroker()
called when the broker becomes the master in a master/slave configuration


getScheduler

Scheduler getScheduler()

getExecutor

ThreadPoolExecutor getExecutor()

networkBridgeStarted

void networkBridgeStarted(BrokerInfo brokerInfo,
                          boolean createdByDuplex,
                          String remoteIp)

networkBridgeStopped

void networkBridgeStopped(BrokerInfo brokerInfo)


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