Class AdvisoryBroker

  • All Implemented Interfaces:
    Broker, Region, org.apache.activemq.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 Detail

      • connections

        protected final ConcurrentMap<org.apache.activemq.command.ConnectionId,​org.apache.activemq.command.ConnectionInfo> connections
      • consumers

        protected final Map<org.apache.activemq.command.ConsumerId,​org.apache.activemq.command.ConsumerInfo> consumers
      • virtualDestinations

        protected final Set<VirtualDestination> virtualDestinations
        This is a set to track all of the virtual destinations that have been added to the broker so they can be easily referenced later.
      • virtualDestinationConsumers

        protected final ConcurrentMap<org.apache.activemq.command.ConsumerInfo,​VirtualDestination> virtualDestinationConsumers
        This is a map to track all consumers that exist on the virtual destination so that we can fire an advisory later when they go away to remove the demand.
      • brokerConsumerDests

        protected final ConcurrentMap<org.apache.activemq.advisory.AdvisoryBroker.VirtualConsumerPair,​org.apache.activemq.command.ConsumerInfo> brokerConsumerDests
        This is a map to track unique demand for the existence of a virtual destination so we make sure we don't send duplicate advisories.
      • producers

        protected final ConcurrentMap<org.apache.activemq.command.ProducerId,​org.apache.activemq.command.ProducerInfo> producers
      • destinations

        protected final ConcurrentMap<org.apache.activemq.command.ActiveMQDestination,​org.apache.activemq.command.DestinationInfo> destinations
      • networkBridges

        protected final ConcurrentMap<org.apache.activemq.command.BrokerInfo,​org.apache.activemq.command.ActiveMQMessage> networkBridges
      • advisoryProducerId

        protected final org.apache.activemq.command.ProducerId advisoryProducerId
    • Constructor Detail

      • AdvisoryBroker

        public AdvisoryBroker​(Broker next)
    • Method Detail

      • addDestination

        public Destination addDestination​(ConnectionContext context,
                                          org.apache.activemq.command.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
      • removeDestination

        public void removeDestination​(ConnectionContext context,
                                      org.apache.activemq.command.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
      • removeConnection

        public void removeConnection​(ConnectionContext context,
                                     org.apache.activemq.command.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
      • messageDiscarded

        public void messageDiscarded​(ConnectionContext context,
                                     Subscription sub,
                                     org.apache.activemq.broker.region.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
      • fastProducer

        public void fastProducer​(ConnectionContext context,
                                 org.apache.activemq.command.ProducerInfo producerInfo,
                                 org.apache.activemq.command.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
      • sendToDeadLetterQueue

        public boolean sendToDeadLetterQueue​(ConnectionContext context,
                                             org.apache.activemq.broker.region.MessageReference messageReference,
                                             Subscription subscription,
                                             Throwable poisonCause)
        Description copied from interface: Broker
        A message needs to go the a DLQ
        Specified by:
        sendToDeadLetterQueue in interface Broker
        Overrides:
        sendToDeadLetterQueue in class BrokerFilter
        poisonCause - reason for dlq submission, may be null
        Returns:
        true if Message was placed in a DLQ false if discarded.
      • fireAdvisory

        protected void fireAdvisory​(ConnectionContext context,
                                    org.apache.activemq.command.ActiveMQTopic topic,
                                    org.apache.activemq.command.Command command)
                             throws Exception
        Throws:
        Exception
      • fireAdvisory

        protected void fireAdvisory​(ConnectionContext context,
                                    org.apache.activemq.command.ActiveMQTopic topic,
                                    org.apache.activemq.command.Command command,
                                    org.apache.activemq.command.ConsumerId targetConsumerId)
                             throws Exception
        Throws:
        Exception
      • fireConsumerAdvisory

        protected void fireConsumerAdvisory​(ConnectionContext context,
                                            org.apache.activemq.command.ActiveMQDestination consumerDestination,
                                            org.apache.activemq.command.ActiveMQTopic topic,
                                            org.apache.activemq.command.Command command)
                                     throws Exception
        Throws:
        Exception
      • fireConsumerAdvisory

        protected void fireConsumerAdvisory​(ConnectionContext context,
                                            org.apache.activemq.command.ActiveMQDestination consumerDestination,
                                            org.apache.activemq.command.ActiveMQTopic topic,
                                            org.apache.activemq.command.Command command,
                                            org.apache.activemq.command.ConsumerId targetConsumerId)
                                     throws Exception
        Throws:
        Exception
      • fireProducerAdvisory

        protected void fireProducerAdvisory​(ConnectionContext context,
                                            org.apache.activemq.command.ActiveMQDestination producerDestination,
                                            org.apache.activemq.command.ActiveMQTopic topic,
                                            org.apache.activemq.command.Command command)
                                     throws Exception
        Throws:
        Exception
      • fireProducerAdvisory

        protected void fireProducerAdvisory​(ConnectionContext context,
                                            org.apache.activemq.command.ActiveMQDestination producerDestination,
                                            org.apache.activemq.command.ActiveMQTopic topic,
                                            org.apache.activemq.command.Command command,
                                            org.apache.activemq.command.ConsumerId targetConsumerId)
                                     throws Exception
        Throws:
        Exception
      • fireAdvisory

        public void fireAdvisory​(ConnectionContext context,
                                 org.apache.activemq.command.ActiveMQTopic topic,
                                 org.apache.activemq.command.Command command,
                                 org.apache.activemq.command.ConsumerId targetConsumerId,
                                 org.apache.activemq.command.ActiveMQMessage advisoryMessage)
                          throws Exception
        Throws:
        Exception
      • getAdvisoryConnections

        public Map<org.apache.activemq.command.ConnectionId,​org.apache.activemq.command.ConnectionInfo> getAdvisoryConnections()
      • getAdvisoryConsumers

        public Collection<org.apache.activemq.command.ConsumerInfo> getAdvisoryConsumers()
      • getAdvisoryProducers

        public Map<org.apache.activemq.command.ProducerId,​org.apache.activemq.command.ProducerInfo> getAdvisoryProducers()
      • getAdvisoryDestinations

        public Map<org.apache.activemq.command.ActiveMQDestination,​org.apache.activemq.command.DestinationInfo> getAdvisoryDestinations()