org.apache.activemq.advisory
Class AdvisoryBroker

java.lang.Object
  extended by org.apache.activemq.broker.BrokerFilter
      extended by org.apache.activemq.advisory.AdvisoryBroker
All Implemented Interfaces:
Broker, Region, Service

public class AdvisoryBroker
extends BrokerFilter

This broker filter handles tracking the state of the broker for purposes of publishing advisory messages to advisory consumers.


Field Summary
protected  ProducerId advisoryProducerId
           
protected  ConcurrentHashMap<ConnectionId,ConnectionInfo> connections
           
protected  ConcurrentHashMap<ConsumerId,ConsumerInfo> consumers
           
protected  ConcurrentHashMap<ActiveMQDestination,DestinationInfo> destinations
           
protected  ConcurrentHashMap<BrokerInfo,ActiveMQMessage> networkBridges
           
protected  ConcurrentHashMap<ProducerId,ProducerInfo> producers
           
 
Fields inherited from class org.apache.activemq.broker.BrokerFilter
next
 
Constructor Summary
AdvisoryBroker(Broker next)
           
 
Method Summary
 void addConnection(ConnectionContext context, ConnectionInfo info)
          A client is establishing a connection with the broker.
 Subscription addConsumer(ConnectionContext context, ConsumerInfo info)
          Adds a consumer.
 Destination addDestination(ConnectionContext context, ActiveMQDestination destination, boolean create)
          Used to create a destination.
 void addDestinationInfo(ConnectionContext context, DestinationInfo info)
          Add and process a DestinationInfo object
 void addProducer(ConnectionContext context, ProducerInfo info)
          Adds a producer.
 void fastProducer(ConnectionContext context, ProducerInfo producerInfo, ActiveMQDestination destination)
          Called to notify a producer is too fast
protected  void fireAdvisory(ConnectionContext context, ActiveMQTopic topic, Command command)
           
protected  void fireAdvisory(ConnectionContext context, ActiveMQTopic topic, Command command, ConsumerId targetConsumerId)
           
protected  void fireAdvisory(ConnectionContext context, ActiveMQTopic topic, Command command, ConsumerId targetConsumerId, ActiveMQMessage advisoryMessage)
           
protected  void fireConsumerAdvisory(ConnectionContext context, ActiveMQDestination consumerDestination, ActiveMQTopic topic, Command command)
           
protected  void fireConsumerAdvisory(ConnectionContext context, ActiveMQDestination consumerDestination, ActiveMQTopic topic, Command command, ConsumerId targetConsumerId)
           
protected  void fireProducerAdvisory(ConnectionContext context, ActiveMQDestination producerDestination, ActiveMQTopic topic, Command command)
           
protected  void fireProducerAdvisory(ConnectionContext context, ActiveMQDestination producerDestination, ActiveMQTopic topic, Command command, ConsumerId targetConsumerId)
           
 Map<ConnectionId,ConnectionInfo> getAdvisoryConnections()
           
 Map<ConsumerId,ConsumerInfo> getAdvisoryConsumers()
           
 Map<ActiveMQDestination,DestinationInfo> getAdvisoryDestinations()
           
 Map<ProducerId,ProducerInfo> getAdvisoryProducers()
           
 void isFull(ConnectionContext context, Destination destination, Usage usage)
          Called when a Usage reaches a limit
 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 removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error)
          A client is disconnecting from the broker.
 void removeConsumer(ConnectionContext context, ConsumerInfo info)
          Removes a consumer.
 void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout)
          Used to destroy a destination.
 void removeDestinationInfo(ConnectionContext context, DestinationInfo destInfo)
          Remove and process a DestinationInfo object
 void removeProducer(ConnectionContext context, ProducerInfo info)
          Removes a producer.
 void sendToDeadLetterQueue(ConnectionContext context, MessageReference messageReference, Subscription subscription)
          A message needs to go the a DLQ
 void slowConsumer(ConnectionContext context, Destination destination, Subscription subs)
          Called when there is a slow consumer
 
Methods inherited from class org.apache.activemq.broker.BrokerFilter
acknowledge, addBroker, addSession, beginTransaction, brokerServiceStarted, commitTransaction, forgetTransaction, gc, getAdaptor, getAdminConnectionContext, getBrokerId, getBrokerName, getBrokerSequenceId, getBrokerService, getClients, getDestinationMap, getDestinations, getDestinations, getDurableDestinations, getExecutor, getPeerBrokerInfos, getPreparedTransactions, getRoot, getScheduler, getTempDataStore, getVmConnectorURI, isExpired, isFaultTolerantConfiguration, isStopped, messagePull, postProcessDispatch, prepareTransaction, preProcessDispatch, processConsumerControl, processDispatchNotification, removeBroker, removeSession, removeSubscription, rollbackTransaction, send, setAdminConnectionContext, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connections

protected final ConcurrentHashMap<ConnectionId,ConnectionInfo> connections

consumers

protected final ConcurrentHashMap<ConsumerId,ConsumerInfo> consumers

producers

protected final ConcurrentHashMap<ProducerId,ProducerInfo> producers

destinations

protected final ConcurrentHashMap<ActiveMQDestination,DestinationInfo> destinations

networkBridges

protected final ConcurrentHashMap<BrokerInfo,ActiveMQMessage> networkBridges

advisoryProducerId

protected final ProducerId advisoryProducerId
Constructor Detail

AdvisoryBroker

public AdvisoryBroker(Broker next)
Method Detail

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

addConsumer

public Subscription addConsumer(ConnectionContext context,
                                ConsumerInfo info)
                         throws Exception
Description copied from interface: Region
Adds a consumer.

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

addProducer

public void addProducer(ConnectionContext context,
                        ProducerInfo info)
                 throws Exception
Description copied from interface: Broker
Adds a producer.

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

addDestination

public Destination addDestination(ConnectionContext context,
                                  ActiveMQDestination destination,
                                  boolean create)
                           throws Exception
Description copied from interface: Region
Used to create a destination. Usually, this method is invoked as a side-effect of sending a message to a destination that does not exist yet.

Specified by:
addDestination in interface Region
Overrides:
addDestination in class BrokerFilter
destination - the destination to create.
Returns:
TODO
Throws:
Exception - TODO

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 BrokerFilter
Throws:
Exception

removeDestination

public void removeDestination(ConnectionContext context,
                              ActiveMQDestination destination,
                              long timeout)
                       throws Exception
Description copied from interface: Region
Used to destroy a destination. This should try to quiesce use of the destination up to the timeout allotted time before removing the destination. This will remove all persistent messages associated with the destination.

Specified by:
removeDestination in interface Region
Overrides:
removeDestination in class BrokerFilter
Parameters:
context - the environment the operation is being executed under.
destination - what is being removed from the broker.
timeout - the max amount of time to wait for the destination to quiesce
Throws:
Exception - TODO

removeDestinationInfo

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

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

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 interface Broker
Overrides:
removeConnection in class BrokerFilter
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

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 BrokerFilter
Parameters:
context - the environment the operation is being executed under.
Throws:
Exception - TODO

removeProducer

public void removeProducer(ConnectionContext context,
                           ProducerInfo info)
                    throws Exception
Description copied from interface: Broker
Removes a producer.

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

messageExpired

public void messageExpired(ConnectionContext context,
                           MessageReference messageReference,
                           Subscription subscription)
Description copied from interface: Broker
A Message has Expired

Specified by:
messageExpired in interface Broker
Overrides:
messageExpired in class BrokerFilter

messageConsumed

public void messageConsumed(ConnectionContext context,
                            MessageReference messageReference)
Description copied from interface: Broker
called when message is consumed

Specified by:
messageConsumed in interface Broker
Overrides:
messageConsumed in class BrokerFilter

messageDelivered

public void messageDelivered(ConnectionContext context,
                             MessageReference messageReference)
Description copied from interface: Broker
Called when message is delivered to the broker

Specified by:
messageDelivered in interface Broker
Overrides:
messageDelivered in class BrokerFilter

messageDiscarded

public void messageDiscarded(ConnectionContext context,
                             Subscription sub,
                             MessageReference messageReference)
Description copied from interface: Broker
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

Specified by:
messageDiscarded in interface Broker
Overrides:
messageDiscarded in class BrokerFilter

slowConsumer

public void slowConsumer(ConnectionContext context,
                         Destination destination,
                         Subscription subs)
Description copied from interface: Broker
Called when there is a slow consumer

Specified by:
slowConsumer in interface Broker
Overrides:
slowConsumer in class BrokerFilter

fastProducer

public void fastProducer(ConnectionContext context,
                         ProducerInfo producerInfo,
                         ActiveMQDestination destination)
Description copied from interface: Broker
Called to notify a producer is too fast

Specified by:
fastProducer in interface Broker
Overrides:
fastProducer in class BrokerFilter

isFull

public void isFull(ConnectionContext context,
                   Destination destination,
                   Usage usage)
Description copied from interface: Broker
Called when a Usage reaches a limit

Specified by:
isFull in interface Broker
Overrides:
isFull in class BrokerFilter

nowMasterBroker

public void nowMasterBroker()
Description copied from interface: Broker
called when the broker becomes the master in a master/slave configuration

Specified by:
nowMasterBroker in interface Broker
Overrides:
nowMasterBroker in class BrokerFilter

sendToDeadLetterQueue

public void sendToDeadLetterQueue(ConnectionContext context,
                                  MessageReference messageReference,
                                  Subscription subscription)
Description copied from interface: Broker
A message needs to go the a DLQ

Specified by:
sendToDeadLetterQueue in interface Broker
Overrides:
sendToDeadLetterQueue in class BrokerFilter

networkBridgeStarted

public void networkBridgeStarted(BrokerInfo brokerInfo,
                                 boolean createdByDuplex,
                                 String remoteIp)
Specified by:
networkBridgeStarted in interface Broker
Overrides:
networkBridgeStarted in class BrokerFilter

networkBridgeStopped

public void networkBridgeStopped(BrokerInfo brokerInfo)
Specified by:
networkBridgeStopped in interface Broker
Overrides:
networkBridgeStopped in class BrokerFilter

fireAdvisory

protected void fireAdvisory(ConnectionContext context,
                            ActiveMQTopic topic,
                            Command command)
                     throws Exception
Throws:
Exception

fireAdvisory

protected void fireAdvisory(ConnectionContext context,
                            ActiveMQTopic topic,
                            Command command,
                            ConsumerId targetConsumerId)
                     throws Exception
Throws:
Exception

fireConsumerAdvisory

protected void fireConsumerAdvisory(ConnectionContext context,
                                    ActiveMQDestination consumerDestination,
                                    ActiveMQTopic topic,
                                    Command command)
                             throws Exception
Throws:
Exception

fireConsumerAdvisory

protected void fireConsumerAdvisory(ConnectionContext context,
                                    ActiveMQDestination consumerDestination,
                                    ActiveMQTopic topic,
                                    Command command,
                                    ConsumerId targetConsumerId)
                             throws Exception
Throws:
Exception

fireProducerAdvisory

protected void fireProducerAdvisory(ConnectionContext context,
                                    ActiveMQDestination producerDestination,
                                    ActiveMQTopic topic,
                                    Command command)
                             throws Exception
Throws:
Exception

fireProducerAdvisory

protected void fireProducerAdvisory(ConnectionContext context,
                                    ActiveMQDestination producerDestination,
                                    ActiveMQTopic topic,
                                    Command command,
                                    ConsumerId targetConsumerId)
                             throws Exception
Throws:
Exception

fireAdvisory

protected void fireAdvisory(ConnectionContext context,
                            ActiveMQTopic topic,
                            Command command,
                            ConsumerId targetConsumerId,
                            ActiveMQMessage advisoryMessage)
                     throws Exception
Throws:
Exception

getAdvisoryConnections

public Map<ConnectionId,ConnectionInfo> getAdvisoryConnections()

getAdvisoryConsumers

public Map<ConsumerId,ConsumerInfo> getAdvisoryConsumers()

getAdvisoryProducers

public Map<ProducerId,ProducerInfo> getAdvisoryProducers()

getAdvisoryDestinations

public Map<ActiveMQDestination,DestinationInfo> getAdvisoryDestinations()


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