Class LoggingBrokerPlugin

  • All Implemented Interfaces:
    Broker, BrokerPlugin, Region, org.apache.activemq.Service

    public class LoggingBrokerPlugin
    extends BrokerPluginSupport
    A simple Broker intercepter which allows you to enable/disable logging.
    • Constructor Detail

      • LoggingBrokerPlugin

        public LoggingBrokerPlugin()
    • Method Detail

      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws Exception
        Throws:
        Exception
      • isLogAll

        public boolean isLogAll()
      • setLogAll

        public void setLogAll​(boolean logAll)
        Logger all Events that go through the Plugin
      • isLogConnectionEvents

        public boolean isLogConnectionEvents()
      • setLogConnectionEvents

        public void setLogConnectionEvents​(boolean logConnectionEvents)
        Logger Events that are related to connections
      • isLogSessionEvents

        public boolean isLogSessionEvents()
      • setLogSessionEvents

        public void setLogSessionEvents​(boolean logSessionEvents)
        Logger Events that are related to sessions
      • isLogTransactionEvents

        public boolean isLogTransactionEvents()
      • setLogTransactionEvents

        public void setLogTransactionEvents​(boolean logTransactionEvents)
        Logger Events that are related to transaction processing
      • isLogConsumerEvents

        public boolean isLogConsumerEvents()
      • setLogConsumerEvents

        public void setLogConsumerEvents​(boolean logConsumerEvents)
        Logger Events that are related to Consumers
      • isLogProducerEvents

        public boolean isLogProducerEvents()
      • setLogProducerEvents

        public void setLogProducerEvents​(boolean logProducerEvents)
        Logger Events that are related to Producers
      • isLogInternalEvents

        public boolean isLogInternalEvents()
      • setLogInternalEvents

        public void setLogInternalEvents​(boolean logInternalEvents)
        Logger Events that are normally internal to the broker
      • acknowledge

        public void acknowledge​(ConsumerBrokerExchange consumerExchange,
                                org.apache.activemq.command.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 BrokerFilter
        Parameters:
        consumerExchange - the environment the operation is being executed under.
        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
      • send

        public void send​(ProducerBrokerExchange producerExchange,
                         org.apache.activemq.command.Message messageSend)
                  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 BrokerFilter
        Parameters:
        producerExchange - the environment the operation is being executed under.
        Throws:
        Exception - TODO
      • 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
      • addBroker

        public void addBroker​(Connection connection,
                              org.apache.activemq.command.BrokerInfo info)
        Description copied from interface: Broker
        A remote Broker connects
        Specified by:
        addBroker in interface Broker
        Overrides:
        addBroker in class BrokerFilter
      • getPeerBrokerInfos

        public org.apache.activemq.command.BrokerInfo[] getPeerBrokerInfos()
        Description copied from interface: Broker
        Get the BrokerInfo's of any connected Brokers
        Specified by:
        getPeerBrokerInfos in interface Broker
        Overrides:
        getPeerBrokerInfos in class BrokerFilter
        Returns:
        array of peer BrokerInfos
      • preProcessDispatch

        public void preProcessDispatch​(org.apache.activemq.command.MessageDispatch messageDispatch)
        Description copied from interface: Broker
        Notify the Broker that a dispatch is going to happen
        Specified by:
        preProcessDispatch in interface Broker
        Overrides:
        preProcessDispatch in class BrokerFilter
      • postProcessDispatch

        public void postProcessDispatch​(org.apache.activemq.command.MessageDispatch messageDispatch)
        Description copied from interface: Broker
        Notify the Broker that a dispatch has happened
        Specified by:
        postProcessDispatch in interface Broker
        Overrides:
        postProcessDispatch 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.
      • 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
      • 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
      • setPerDestinationLogger

        public void setPerDestinationLogger​(boolean perDestinationLogger)
      • isPerDestinationLogger

        public boolean isPerDestinationLogger()