org.apache.activemq.broker.util
Class LoggingBrokerPlugin

java.lang.Object
  extended by org.apache.activemq.broker.MutableBrokerFilter
      extended by org.apache.activemq.broker.BrokerPluginSupport
          extended by org.apache.activemq.broker.util.LoggingBrokerPlugin
All Implemented Interfaces:
Broker, BrokerPlugin, Region, Service

public class LoggingBrokerPlugin
extends BrokerPluginSupport

A simple Broker intercepter which allows you to enable/disable logging.


Field Summary
 
Fields inherited from class org.apache.activemq.broker.MutableBrokerFilter
next
 
Constructor Summary
LoggingBrokerPlugin()
           
 
Method Summary
 void acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack)
          Used to acknowledge the receipt of a message by a client.
 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.
 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 addSession(ConnectionContext context, SessionInfo info)
          Adds a session.
 void afterPropertiesSet()
           
 void beginTransaction(ConnectionContext context, TransactionId xid)
          Starts a transaction.
 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.
 Connection[] getClients()
           
 ActiveMQDestination[] getDestinations()
           
 Set<ActiveMQDestination> getDurableDestinations()
           
 BrokerInfo[] getPeerBrokerInfos()
          Get the BrokerInfo's of any connected Brokers
 TransactionId[] getPreparedTransactions(ConnectionContext context)
          Gets a list of all the prepared xa transactions.
 void isFull(ConnectionContext context, Destination destination, Usage usage)
          Called when a Usage reaches a limit
 boolean isLogAll()
           
 boolean isLogConnectionEvents()
           
 boolean isLogConsumerEvents()
           
 boolean isLogInternalEvents()
           
 boolean isLogMessageEvents()
           
 boolean isLogProducerEvents()
           
 boolean isLogSessionEvents()
           
 boolean isLogTransactionEvents()
           
 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 message, Subscription subscription)
          A Message has Expired
 Response messagePull(ConnectionContext context, MessagePull pull)
          Allows a consumer to pull a message from a queue
 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 processDispatchNotification(MessageDispatchNotification messageDispatchNotification)
          Process a notification of a dispatch - used by a Slave Broker
 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 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 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)
          Deletes a durable subscription.
 void rollbackTransaction(ConnectionContext context, TransactionId xid)
          Rollsback a transaction.
 void send(ProducerBrokerExchange producerExchange, Message messageSend)
          Send a message to the broker to using the specified destination.
 void sendToDeadLetterQueue(ConnectionContext context, MessageReference messageReference, Subscription subscription)
          A message needs to go the a DLQ
 void setLogAll(boolean logAll)
          Logger all Events that go through the Plugin
 void setLogConnectionEvents(boolean logConnectionEvents)
          Logger Events that are related to connections
 void setLogConsumerEvents(boolean logConsumerEvents)
          Logger Events that are related to Consumers
 void setLogInternalEvents(boolean logInternalEvents)
          Logger Events that are normally internal to the broker
 void setLogMessageEvents(boolean logMessageEvents)
          Logger Events that are related to message processing
 void setLogProducerEvents(boolean logProducerEvents)
          Logger Events that are related to Producers
 void setLogSessionEvents(boolean logSessionEvents)
          Logger Events that are related to sessions
 void setLogTransactionEvents(boolean logTransactionEvents)
          Logger Events that are related to transaction processing
 void slowConsumer(ConnectionContext context, Destination destination, Subscription subs)
          Called when there is a slow consumer
 void start()
           
 void stop()
           
 String toString()
           
 
Methods inherited from class org.apache.activemq.broker.BrokerPluginSupport
installPlugin
 
Methods inherited from class org.apache.activemq.broker.MutableBrokerFilter
brokerServiceStarted, gc, getAdaptor, getAdminConnectionContext, getBrokerId, getBrokerName, getBrokerSequenceId, getBrokerService, getDestinationMap, getDestinations, getExecutor, getNext, getRoot, getScheduler, getTempDataStore, getVmConnectorURI, isExpired, isFaultTolerantConfiguration, isStopped, networkBridgeStarted, networkBridgeStopped, processConsumerControl, setAdminConnectionContext, setNext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LoggingBrokerPlugin

public LoggingBrokerPlugin()
Method Detail

afterPropertiesSet

@PostConstruct
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


isLogMessageEvents

public boolean isLogMessageEvents()

setLogMessageEvents

public void setLogMessageEvents(boolean logMessageEvents)
Logger Events that are related to message processing


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

messagePull

public Response messagePull(ConnectionContext context,
                            MessagePull pull)
                     throws Exception
Description copied from interface: Region
Allows a consumer to pull a message from a queue

Specified by:
messagePull in interface Region
Overrides:
messagePull in class MutableBrokerFilter
Throws:
Exception

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

commitTransaction

public void commitTransaction(ConnectionContext context,
                              TransactionId xid,
                              boolean onePhase)
                       throws Exception
Description copied from interface: Broker
Commits a transaction.

Specified by:
commitTransaction in interface Broker
Overrides:
commitTransaction in class MutableBrokerFilter
Throws:
Exception - TODO

removeSubscription

public void removeSubscription(ConnectionContext context,
                               RemoveSubscriptionInfo info)
                        throws Exception
Description copied from interface: Region
Deletes a durable subscription.

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

getPreparedTransactions

public TransactionId[] getPreparedTransactions(ConnectionContext context)
                                        throws Exception
Description copied from interface: Broker
Gets a list of all the prepared xa transactions.

Specified by:
getPreparedTransactions in interface Broker
Overrides:
getPreparedTransactions in class MutableBrokerFilter
Parameters:
context - transaction ids
Returns:
Throws:
Exception - TODO

prepareTransaction

public int prepareTransaction(ConnectionContext context,
                              TransactionId xid)
                       throws Exception
Description copied from interface: Broker
Prepares a transaction. Only valid for xa transactions.

Specified by:
prepareTransaction in interface Broker
Overrides:
prepareTransaction in class MutableBrokerFilter
Returns:
id
Throws:
Exception - TODO

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

rollbackTransaction

public void rollbackTransaction(ConnectionContext context,
                                TransactionId xid)
                         throws Exception
Description copied from interface: Broker
Rollsback a transaction.

Specified by:
rollbackTransaction in interface Broker
Overrides:
rollbackTransaction in class MutableBrokerFilter
Throws:
Exception - TODO

send

public void send(ProducerBrokerExchange producerExchange,
                 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 MutableBrokerFilter
Parameters:
producerExchange - the environment the operation is being executed under.
Throws:
Exception - TODO

beginTransaction

public void beginTransaction(ConnectionContext context,
                             TransactionId xid)
                      throws Exception
Description copied from interface: Broker
Starts a transaction.

Specified by:
beginTransaction in interface Broker
Overrides:
beginTransaction in class MutableBrokerFilter
Throws:
Exception - TODO

forgetTransaction

public void forgetTransaction(ConnectionContext context,
                              TransactionId transactionId)
                       throws Exception
Description copied from interface: Broker
Forgets a transaction.

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

getClients

public Connection[] getClients()
                        throws Exception
Specified by:
getClients in interface Broker
Overrides:
getClients in class MutableBrokerFilter
Returns:
all clients added to the Broker.
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 MutableBrokerFilter
destination - the destination to create.
Returns:
TODO
Throws:
Exception - TODO

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

getDestinations

public ActiveMQDestination[] getDestinations()
                                      throws Exception
Specified by:
getDestinations in interface Broker
Overrides:
getDestinations in class MutableBrokerFilter
Returns:
all destinations added to the Broker.
Throws:
Exception - TODO

start

public void start()
           throws Exception
Specified by:
start in interface Service
Overrides:
start in class BrokerPluginSupport
Throws:
Exception

stop

public void stop()
          throws Exception
Specified by:
stop in interface Service
Overrides:
stop in class BrokerPluginSupport
Throws:
Exception

addSession

public void addSession(ConnectionContext context,
                       SessionInfo info)
                throws Exception
Description copied from interface: Broker
Adds a session.

Specified by:
addSession in interface Broker
Overrides:
addSession in class MutableBrokerFilter
Throws:
Exception - TODO

removeSession

public void removeSession(ConnectionContext context,
                          SessionInfo info)
                   throws Exception
Description copied from interface: Broker
Removes a session.

Specified by:
removeSession in interface Broker
Overrides:
removeSession in class MutableBrokerFilter
Throws:
Exception - TODO

addBroker

public void addBroker(Connection connection,
                      BrokerInfo info)
Description copied from interface: Broker
A remote Broker connects

Specified by:
addBroker in interface Broker
Overrides:
addBroker in class MutableBrokerFilter

removeBroker

public void removeBroker(Connection connection,
                         BrokerInfo info)
Description copied from interface: Broker
Remove a BrokerInfo

Specified by:
removeBroker in interface Broker
Overrides:
removeBroker in class MutableBrokerFilter

getPeerBrokerInfos

public 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 MutableBrokerFilter
Returns:
array of peer BrokerInfos

preProcessDispatch

public void preProcessDispatch(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 MutableBrokerFilter

postProcessDispatch

public void postProcessDispatch(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 MutableBrokerFilter

processDispatchNotification

public void processDispatchNotification(MessageDispatchNotification messageDispatchNotification)
                                 throws Exception
Description copied from interface: Region
Process a notification of a dispatch - used by a Slave Broker

Specified by:
processDispatchNotification in interface Region
Overrides:
processDispatchNotification in class MutableBrokerFilter
Throws:
Exception - TODO

getDurableDestinations

public Set<ActiveMQDestination> getDurableDestinations()
Specified by:
getDurableDestinations in interface Broker
Overrides:
getDurableDestinations in class MutableBrokerFilter
Returns:
a Set of all durable destinations

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

messageExpired

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

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

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 MutableBrokerFilter

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 MutableBrokerFilter

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 MutableBrokerFilter

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 MutableBrokerFilter

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 MutableBrokerFilter

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 MutableBrokerFilter

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 MutableBrokerFilter

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 MutableBrokerFilter

toString

public String toString()
Overrides:
toString in class Object


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