Package org.apache.activemq.broker.util
Class LoggingBrokerPlugin
java.lang.Object
org.apache.activemq.broker.BrokerFilter
org.apache.activemq.broker.MutableBrokerFilter
org.apache.activemq.broker.BrokerPluginSupport
org.apache.activemq.broker.util.LoggingBrokerPlugin
- All Implemented Interfaces:
Broker,BrokerPlugin,Region,org.apache.activemq.Service
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidacknowledge(ConsumerBrokerExchange consumerExchange, org.apache.activemq.command.MessageAck ack) Used to acknowledge the receipt of a message by a client.voidaddBroker(Connection connection, org.apache.activemq.command.BrokerInfo info) A remote Broker connectsvoidaddConnection(ConnectionContext context, org.apache.activemq.command.ConnectionInfo info) A client is establishing a connection with the broker.addConsumer(ConnectionContext context, org.apache.activemq.command.ConsumerInfo info) Adds a consumer.addDestination(ConnectionContext context, org.apache.activemq.command.ActiveMQDestination destination, boolean create) Used to create a destination.voidaddDestinationInfo(ConnectionContext context, org.apache.activemq.command.DestinationInfo info) Add and process a DestinationInfo objectvoidaddProducer(ConnectionContext context, org.apache.activemq.command.ProducerInfo info) Adds a producer.voidaddSession(ConnectionContext context, org.apache.activemq.command.SessionInfo info) Adds a session.voidvoidbeginTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid) Starts a transaction.voidcommitTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid, boolean onePhase) Commits a transaction.voidfastProducer(ConnectionContext context, org.apache.activemq.command.ProducerInfo producerInfo, org.apache.activemq.command.ActiveMQDestination destination) Called to notify a producer is too fastvoidforgetTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId transactionId) Forgets a transaction.org.apache.activemq.command.ActiveMQDestination[]Set<org.apache.activemq.command.ActiveMQDestination>org.apache.activemq.command.BrokerInfo[]Get the BrokerInfo's of any connected Brokersorg.apache.activemq.command.TransactionId[]getPreparedTransactions(ConnectionContext context) Gets a list of all the prepared xa transactions.voidisFull(ConnectionContext context, Destination destination, org.apache.activemq.usage.Usage<?> usage) Called when a Usage reaches a limitbooleanisLogAll()booleanbooleanbooleanbooleanbooleanbooleanbooleanvoidmessageConsumed(ConnectionContext context, org.apache.activemq.broker.region.MessageReference messageReference) called when message is consumedvoidmessageDelivered(ConnectionContext context, org.apache.activemq.broker.region.MessageReference messageReference) Called when message is delivered to the brokervoidmessageDiscarded(ConnectionContext context, Subscription sub, org.apache.activemq.broker.region.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 topicsvoidmessageDispatched(ConnectionContext context, Subscription sub, org.apache.activemq.broker.region.MessageReference messageReference) Called when message is dispatched to a consumervoidmessageExpired(ConnectionContext context, org.apache.activemq.broker.region.MessageReference message, Subscription subscription) A Message has Expiredorg.apache.activemq.command.ResponsemessagePull(ConnectionContext context, org.apache.activemq.command.MessagePull pull) Allows a consumer to pull a message from a queuevoidcalled when the broker becomes the master in a master/slave configurationvoidpostProcessDispatch(org.apache.activemq.command.MessageDispatch messageDispatch) Notify the Broker that a dispatch has happenedintprepareTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid) Prepares a transaction.voidpreProcessDispatch(org.apache.activemq.command.MessageDispatch messageDispatch) Notify the Broker that a dispatch is going to happenvoidprocessDispatchNotification(org.apache.activemq.command.MessageDispatchNotification messageDispatchNotification) Process a notification of a dispatch - used by a Slave BrokervoidremoveBroker(Connection connection, org.apache.activemq.command.BrokerInfo info) Remove a BrokerInfovoidremoveConnection(ConnectionContext context, org.apache.activemq.command.ConnectionInfo info, Throwable error) A client is disconnecting from the broker.voidremoveConsumer(ConnectionContext context, org.apache.activemq.command.ConsumerInfo info) Removes a consumer.voidremoveDestination(ConnectionContext context, org.apache.activemq.command.ActiveMQDestination destination, long timeout) Used to destroy a destination.voidremoveDestinationInfo(ConnectionContext context, org.apache.activemq.command.DestinationInfo info) Remove and process a DestinationInfo objectvoidremoveProducer(ConnectionContext context, org.apache.activemq.command.ProducerInfo info) Removes a producer.voidremoveSession(ConnectionContext context, org.apache.activemq.command.SessionInfo info) Removes a session.voidremoveSubscription(ConnectionContext context, org.apache.activemq.command.RemoveSubscriptionInfo info) Deletes a durable subscription.voidrollbackTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid) Rollback a transaction.voidsend(ProducerBrokerExchange producerExchange, org.apache.activemq.command.Message messageSend) Send a message to the broker to using the specified destination.booleansendToDeadLetterQueue(ConnectionContext context, org.apache.activemq.broker.region.MessageReference messageReference, Subscription subscription, Throwable poisonCause) A message needs to go to the DLQvoidsetLogAll(boolean logAll) Logger all Events that go through the PluginvoidsetLogConnectionEvents(boolean logConnectionEvents) Logger Events that are related to connectionsvoidsetLogConsumerEvents(boolean logConsumerEvents) Logger Events that are related to ConsumersvoidsetLogInternalEvents(boolean logInternalEvents) Logger Events that are normally internal to the brokervoidsetLogProducerEvents(boolean logProducerEvents) Logger Events that are related to ProducersvoidsetLogSessionEvents(boolean logSessionEvents) Logger Events that are related to sessionsvoidsetLogTransactionEvents(boolean logTransactionEvents) Logger Events that are related to transaction processingvoidsetPerDestinationLogger(boolean perDestinationLogger) voidslowConsumer(ConnectionContext context, Destination destination, Subscription subs) Called when there is a slow consumervoidstart()voidstop()toString()Methods inherited from class org.apache.activemq.broker.BrokerPluginSupport
installPluginMethods inherited from class org.apache.activemq.broker.MutableBrokerFilter
getAdaptor, getNext, setNextMethods inherited from class org.apache.activemq.broker.BrokerFilter
brokerServiceStarted, gc, getAdminConnectionContext, getBrokerId, getBrokerName, getBrokerSequenceId, getBrokerService, getDestinationMap, getDestinationMap, getDestinations, getExecutor, getRoot, getScheduler, getTempDataStore, getVmConnectorURI, isExpired, isFaultTolerantConfiguration, isStopped, networkBridgeStarted, networkBridgeStopped, processConsumerControl, reapplyInterceptor, setAdminConnectionContext, virtualDestinationAdded, virtualDestinationRemoved
-
Constructor Details
-
LoggingBrokerPlugin
public LoggingBrokerPlugin()
-
-
Method Details
-
afterPropertiesSet
- 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:RegionUsed to acknowledge the receipt of a message by a client.- Specified by:
acknowledgein interfaceRegion- Overrides:
acknowledgein classBrokerFilter- Parameters:
consumerExchange- the environment the operation is being executed under.- Throws:
Exception- TODO
-
messagePull
public org.apache.activemq.command.Response messagePull(ConnectionContext context, org.apache.activemq.command.MessagePull pull) throws Exception Description copied from interface:RegionAllows a consumer to pull a message from a queue- Specified by:
messagePullin interfaceRegion- Overrides:
messagePullin classBrokerFilter- Throws:
Exception
-
addConnection
public void addConnection(ConnectionContext context, org.apache.activemq.command.ConnectionInfo info) throws Exception Description copied from interface:BrokerA client is establishing a connection with the broker.- Specified by:
addConnectionin interfaceBroker- Overrides:
addConnectionin classBrokerFilter- Throws:
Exception- TODO
-
addConsumer
public Subscription addConsumer(ConnectionContext context, org.apache.activemq.command.ConsumerInfo info) throws Exception Description copied from interface:RegionAdds a consumer.- Specified by:
addConsumerin interfaceRegion- Overrides:
addConsumerin classBrokerFilter- Parameters:
context- the environment the operation is being executed under.- Returns:
- TODO
- Throws:
Exception- TODO
-
addProducer
public void addProducer(ConnectionContext context, org.apache.activemq.command.ProducerInfo info) throws Exception Description copied from interface:BrokerAdds a producer.- Specified by:
addProducerin interfaceBroker- Specified by:
addProducerin interfaceRegion- Overrides:
addProducerin classBrokerFilter- Parameters:
context- the environment the operation is being executed under.- Throws:
Exception- TODO
-
commitTransaction
public void commitTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid, boolean onePhase) throws Exception Description copied from interface:BrokerCommits a transaction.- Specified by:
commitTransactionin interfaceBroker- Overrides:
commitTransactionin classBrokerFilter- Parameters:
context- connection contextxid- transaction idonePhase- is COMMIT_ONE_PHASE- Throws:
Exception- TODO
-
removeSubscription
public void removeSubscription(ConnectionContext context, org.apache.activemq.command.RemoveSubscriptionInfo info) throws Exception Description copied from interface:RegionDeletes a durable subscription.- Specified by:
removeSubscriptionin interfaceRegion- Overrides:
removeSubscriptionin classBrokerFilter- Parameters:
context- the environment the operation is being executed under.info- TODO- Throws:
Exception- TODO
-
getPreparedTransactions
public org.apache.activemq.command.TransactionId[] getPreparedTransactions(ConnectionContext context) throws Exception Description copied from interface:BrokerGets a list of all the prepared xa transactions.- Specified by:
getPreparedTransactionsin interfaceBroker- Overrides:
getPreparedTransactionsin classBrokerFilter- Parameters:
context- transaction ids- Returns:
- array of TransactionId values
- Throws:
Exception- TODO
-
prepareTransaction
public int prepareTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid) throws Exception Description copied from interface:BrokerPrepares a transaction. Only valid for xa transactions.- Specified by:
prepareTransactionin interfaceBroker- Overrides:
prepareTransactionin classBrokerFilter- Parameters:
context- connection contextxid- transaction id- Returns:
- id
- Throws:
Exception- TODO
-
removeConnection
public void removeConnection(ConnectionContext context, org.apache.activemq.command.ConnectionInfo info, Throwable error) throws Exception Description copied from interface:BrokerA client is disconnecting from the broker.- Specified by:
removeConnectionin interfaceBroker- Overrides:
removeConnectionin classBrokerFilter- Parameters:
context- the environment the operation is being executed under.info- metadata about the Brokererror- 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, org.apache.activemq.command.ConsumerInfo info) throws Exception Description copied from interface:RegionRemoves a consumer.- Specified by:
removeConsumerin interfaceRegion- Overrides:
removeConsumerin classBrokerFilter- Parameters:
context- the environment the operation is being executed under.- Throws:
Exception- TODO
-
removeProducer
public void removeProducer(ConnectionContext context, org.apache.activemq.command.ProducerInfo info) throws Exception Description copied from interface:BrokerRemoves a producer.- Specified by:
removeProducerin interfaceBroker- Specified by:
removeProducerin interfaceRegion- Overrides:
removeProducerin classBrokerFilter- Parameters:
context- the environment the operation is being executed under.- Throws:
Exception- TODO
-
rollbackTransaction
public void rollbackTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid) throws Exception Description copied from interface:BrokerRollback a transaction.- Specified by:
rollbackTransactionin interfaceBroker- Overrides:
rollbackTransactionin classBrokerFilter- Parameters:
context- connection contextxid- transaction id- Throws:
Exception- TODO
-
send
public void send(ProducerBrokerExchange producerExchange, org.apache.activemq.command.Message messageSend) throws Exception Description copied from interface:RegionSend 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:
sendin interfaceRegion- Overrides:
sendin classBrokerFilter- Parameters:
producerExchange- the environment the operation is being executed under.- Throws:
Exception- TODO
-
beginTransaction
public void beginTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId xid) throws Exception Description copied from interface:BrokerStarts a transaction.- Specified by:
beginTransactionin interfaceBroker- Overrides:
beginTransactionin classBrokerFilter- Parameters:
context- connection contextxid- transaction id- Throws:
Exception- TODO
-
forgetTransaction
public void forgetTransaction(ConnectionContext context, org.apache.activemq.command.TransactionId transactionId) throws Exception Description copied from interface:BrokerForgets a transaction.- Specified by:
forgetTransactionin interfaceBroker- Overrides:
forgetTransactionin classBrokerFilter- Parameters:
context- connection contexttransactionId- transaction id- Throws:
Exception- TODO
-
getClients
- Specified by:
getClientsin interfaceBroker- Overrides:
getClientsin classBrokerFilter- Returns:
- all clients added to the Broker.
- Throws:
Exception- TODO
-
addDestination
public Destination addDestination(ConnectionContext context, org.apache.activemq.command.ActiveMQDestination destination, boolean create) throws Exception Description copied from interface:RegionUsed 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:
addDestinationin interfaceRegion- Overrides:
addDestinationin classBrokerFilterdestination- 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:RegionUsed 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:
removeDestinationin interfaceRegion- Overrides:
removeDestinationin classBrokerFilter- 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
- Specified by:
getDestinationsin interfaceBroker- Overrides:
getDestinationsin classBrokerFilter- Returns:
- all destinations added to the Broker.
- Throws:
Exception- TODO
-
start
- Specified by:
startin interfaceorg.apache.activemq.Service- Overrides:
startin classBrokerPluginSupport- Throws:
Exception
-
stop
- Specified by:
stopin interfaceorg.apache.activemq.Service- Overrides:
stopin classBrokerPluginSupport- Throws:
Exception
-
addSession
public void addSession(ConnectionContext context, org.apache.activemq.command.SessionInfo info) throws Exception Description copied from interface:BrokerAdds a session.- Specified by:
addSessionin interfaceBroker- Overrides:
addSessionin classBrokerFilter- Parameters:
context- connection contextinfo- metadata about the Broker- Throws:
Exception- TODO
-
removeSession
public void removeSession(ConnectionContext context, org.apache.activemq.command.SessionInfo info) throws Exception Description copied from interface:BrokerRemoves a session.- Specified by:
removeSessionin interfaceBroker- Overrides:
removeSessionin classBrokerFilter- Parameters:
context- connection contextinfo- metadata about the Broker- Throws:
Exception- TODO
-
addBroker
Description copied from interface:BrokerA remote Broker connects- Specified by:
addBrokerin interfaceBroker- Overrides:
addBrokerin classBrokerFilter
-
removeBroker
Description copied from interface:BrokerRemove a BrokerInfo- Specified by:
removeBrokerin interfaceBroker- Overrides:
removeBrokerin classBrokerFilter- Parameters:
connection- Broker connectioninfo- metadata about the Broker
-
getPeerBrokerInfos
public org.apache.activemq.command.BrokerInfo[] getPeerBrokerInfos()Description copied from interface:BrokerGet the BrokerInfo's of any connected Brokers- Specified by:
getPeerBrokerInfosin interfaceBroker- Overrides:
getPeerBrokerInfosin classBrokerFilter- Returns:
- array of peer BrokerInfos
-
preProcessDispatch
public void preProcessDispatch(org.apache.activemq.command.MessageDispatch messageDispatch) Description copied from interface:BrokerNotify the Broker that a dispatch is going to happen- Specified by:
preProcessDispatchin interfaceBroker- Overrides:
preProcessDispatchin classBrokerFilter- Parameters:
messageDispatch- MessageDispatch object being dispatched
-
postProcessDispatch
public void postProcessDispatch(org.apache.activemq.command.MessageDispatch messageDispatch) Description copied from interface:BrokerNotify the Broker that a dispatch has happened- Specified by:
postProcessDispatchin interfaceBroker- Overrides:
postProcessDispatchin classBrokerFilter- Parameters:
messageDispatch- MessageDispatch that has dispatched
-
processDispatchNotification
public void processDispatchNotification(org.apache.activemq.command.MessageDispatchNotification messageDispatchNotification) throws Exception Description copied from interface:RegionProcess a notification of a dispatch - used by a Slave Broker- Specified by:
processDispatchNotificationin interfaceRegion- Overrides:
processDispatchNotificationin classBrokerFilter- Throws:
Exception- TODO
-
getDurableDestinations
- Specified by:
getDurableDestinationsin interfaceBroker- Overrides:
getDurableDestinationsin classBrokerFilter- Returns:
- a Set of all durable destinations
-
addDestinationInfo
public void addDestinationInfo(ConnectionContext context, org.apache.activemq.command.DestinationInfo info) throws Exception Description copied from interface:BrokerAdd and process a DestinationInfo object- Specified by:
addDestinationInfoin interfaceBroker- Overrides:
addDestinationInfoin classBrokerFilter- Parameters:
context- connection contextinfo- destination info- Throws:
Exception- TODO
-
removeDestinationInfo
public void removeDestinationInfo(ConnectionContext context, org.apache.activemq.command.DestinationInfo info) throws Exception Description copied from interface:BrokerRemove and process a DestinationInfo object- Specified by:
removeDestinationInfoin interfaceBroker- Overrides:
removeDestinationInfoin classBrokerFilter- Parameters:
context- connection contextinfo- destination info- Throws:
Exception- TODO
-
messageExpired
public void messageExpired(ConnectionContext context, org.apache.activemq.broker.region.MessageReference message, Subscription subscription) Description copied from interface:BrokerA Message has Expired- Specified by:
messageExpiredin interfaceBroker- Overrides:
messageExpiredin classBrokerFilter- Parameters:
context- connection contextmessage- message referencesubscription- (maybe null)
-
sendToDeadLetterQueue
public boolean sendToDeadLetterQueue(ConnectionContext context, org.apache.activemq.broker.region.MessageReference messageReference, Subscription subscription, Throwable poisonCause) Description copied from interface:BrokerA message needs to go to the DLQ- Specified by:
sendToDeadLetterQueuein interfaceBroker- Overrides:
sendToDeadLetterQueuein classBrokerFilter- Parameters:
context- connection contextmessageReference- message referencepoisonCause- 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:BrokerCalled to notify a producer is too fast- Specified by:
fastProducerin interfaceBroker- Overrides:
fastProducerin classBrokerFilter- Parameters:
context- connection contextproducerInfo- producer infodestination- destination
-
isFull
public void isFull(ConnectionContext context, Destination destination, org.apache.activemq.usage.Usage<?> usage) Description copied from interface:BrokerCalled when a Usage reaches a limit- Specified by:
isFullin interfaceBroker- Overrides:
isFullin classBrokerFilter- Parameters:
context- create new scratch file from selectiondestination- destinationusage- usage
-
messageConsumed
public void messageConsumed(ConnectionContext context, org.apache.activemq.broker.region.MessageReference messageReference) Description copied from interface:Brokercalled when message is consumed- Specified by:
messageConsumedin interfaceBroker- Overrides:
messageConsumedin classBrokerFilter- Parameters:
context- connection contextmessageReference- message reference
-
messageDelivered
public void messageDelivered(ConnectionContext context, org.apache.activemq.broker.region.MessageReference messageReference) Description copied from interface:BrokerCalled when message is delivered to the broker- Specified by:
messageDeliveredin interfaceBroker- Overrides:
messageDeliveredin classBrokerFilter- Parameters:
context- connection contextmessageReference- message reference
-
messageDispatched
public void messageDispatched(ConnectionContext context, Subscription sub, org.apache.activemq.broker.region.MessageReference messageReference) Description copied from interface:BrokerCalled when message is dispatched to a consumer- Specified by:
messageDispatchedin interfaceBroker- Overrides:
messageDispatchedin classBrokerFilter- Parameters:
context- connection contextsub- subscriptionmessageReference- message reference
-
messageDiscarded
public void messageDiscarded(ConnectionContext context, Subscription sub, org.apache.activemq.broker.region.MessageReference messageReference) Description copied from interface:BrokerCalled 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:
messageDiscardedin interfaceBroker- Overrides:
messageDiscardedin classBrokerFilter- Parameters:
context- connection contextsub- subscriptionmessageReference- message reference
-
slowConsumer
Description copied from interface:BrokerCalled when there is a slow consumer- Specified by:
slowConsumerin interfaceBroker- Overrides:
slowConsumerin classBrokerFilter- Parameters:
context- connection contextdestination- destinationsubs- subscription
-
nowMasterBroker
public void nowMasterBroker()Description copied from interface:Brokercalled when the broker becomes the master in a master/slave configuration- Specified by:
nowMasterBrokerin interfaceBroker- Overrides:
nowMasterBrokerin classBrokerFilter
-
toString
-
setPerDestinationLogger
public void setPerDestinationLogger(boolean perDestinationLogger) -
isPerDestinationLogger
public boolean isPerDestinationLogger()
-