Package org.apache.activemq.broker.util
Class UDPTraceBrokerPlugin
- java.lang.Object
-
- org.apache.activemq.broker.BrokerFilter
-
- org.apache.activemq.broker.MutableBrokerFilter
-
- org.apache.activemq.broker.BrokerPluginSupport
-
- org.apache.activemq.broker.util.UDPTraceBrokerPlugin
-
- All Implemented Interfaces:
Broker
,BrokerPlugin
,Region
,Service
- Direct Known Subclasses:
MulticastTraceBrokerPlugin
public class UDPTraceBrokerPlugin extends BrokerPluginSupport
A Broker interceptor which allows you to trace all operations to a UDP socket.
-
-
Field Summary
Fields Modifier and Type Field Description protected SocketAddress
address
protected boolean
broadcast
protected BrokerId
brokerId
protected URI
destination
protected int
maxTraceDatagramSize
protected DatagramSocket
socket
protected WireFormat
wireFormat
protected WireFormatFactory
wireFormatFactory
-
Fields inherited from class org.apache.activemq.broker.MutableBrokerFilter
next
-
-
Constructor Summary
Constructors Constructor Description UDPTraceBrokerPlugin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack)
Used to acknowledge the receipt of a message by a client.void
addConnection(ConnectionContext context, ConnectionInfo info)
A client is establishing a connection with the broker.Subscription
addConsumer(ConnectionContext context, ConsumerInfo info)
Adds a consumer.void
addDestinationInfo(ConnectionContext context, DestinationInfo info)
Add and process a DestinationInfo objectvoid
addProducer(ConnectionContext context, ProducerInfo info)
Adds a producer.void
addSession(ConnectionContext context, SessionInfo info)
Adds a session.void
beginTransaction(ConnectionContext context, TransactionId xid)
Starts a transaction.void
commitTransaction(ConnectionContext context, TransactionId xid, boolean onePhase)
Commits a transaction.protected DatagramSocket
createSocket()
protected SocketAddress
createSocketAddress(URI location)
protected WireFormat
createWireFormat()
protected OpenWireFormatFactory
createWireFormatFactory()
void
forgetTransaction(ConnectionContext context, TransactionId xid)
Forgets a transaction.SocketAddress
getAddress()
URI
getDestination()
int
getMaxTraceDatagramSize()
WireFormat
getWireFormat()
WireFormatFactory
getWireFormatFactory()
boolean
isBroadcast()
Response
messagePull(ConnectionContext context, MessagePull pull)
Allows a consumer to pull a message from a queuevoid
postProcessDispatch(MessageDispatch messageDispatch)
Notify the Broker that a dispatch has happenedint
prepareTransaction(ConnectionContext context, TransactionId xid)
Prepares a transaction.void
processDispatchNotification(MessageDispatchNotification messageDispatchNotification)
Process a notification of a dispatch - used by a Slave Brokervoid
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 objectvoid
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
setAddress(SocketAddress address)
void
setBroadcast(boolean broadcast)
void
setDestination(URI destination)
void
setMaxTraceDatagramSize(int maxTraceDatagramSize)
void
setWireFormat(WireFormat wireFormat)
void
setWireFormatFactory(WireFormatFactory wireFormatFactory)
void
start()
void
stop()
-
Methods inherited from class org.apache.activemq.broker.BrokerPluginSupport
installPlugin
-
Methods inherited from class org.apache.activemq.broker.MutableBrokerFilter
getAdaptor, getNext, setNext
-
Methods inherited from class org.apache.activemq.broker.BrokerFilter
addBroker, addDestination, brokerServiceStarted, fastProducer, gc, getAdminConnectionContext, getBrokerId, getBrokerName, getBrokerSequenceId, getBrokerService, getClients, getDestinationMap, getDestinationMap, getDestinations, getDestinations, getDurableDestinations, getExecutor, getPeerBrokerInfos, getPreparedTransactions, getRoot, getScheduler, getTempDataStore, getVmConnectorURI, isExpired, isFaultTolerantConfiguration, isFull, isStopped, messageConsumed, messageDelivered, messageDiscarded, messageExpired, networkBridgeStarted, networkBridgeStopped, nowMasterBroker, preProcessDispatch, processConsumerControl, reapplyInterceptor, removeBroker, sendToDeadLetterQueue, setAdminConnectionContext, slowConsumer, virtualDestinationAdded, virtualDestinationRemoved
-
-
-
-
Field Detail
-
wireFormat
protected WireFormat wireFormat
-
wireFormatFactory
protected WireFormatFactory wireFormatFactory
-
maxTraceDatagramSize
protected int maxTraceDatagramSize
-
destination
protected URI destination
-
socket
protected DatagramSocket socket
-
brokerId
protected BrokerId brokerId
-
address
protected SocketAddress address
-
broadcast
protected boolean broadcast
-
-
Method Detail
-
start
public void start() throws Exception
- Specified by:
start
in interfaceService
- Overrides:
start
in classBrokerPluginSupport
- Throws:
Exception
-
createSocket
protected DatagramSocket createSocket() throws IOException
- Throws:
IOException
-
stop
public void stop() throws Exception
- Specified by:
stop
in interfaceService
- Overrides:
stop
in classBrokerPluginSupport
- Throws:
Exception
-
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 interfaceRegion
- Overrides:
send
in classBrokerFilter
- Parameters:
producerExchange
- the environment the operation is being executed under.- Throws:
Exception
- TODO
-
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 interfaceRegion
- Overrides:
acknowledge
in classBrokerFilter
- Parameters:
consumerExchange
- the environment the operation is being executed under.- Throws:
Exception
- TODO
-
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 interfaceBroker
- Overrides:
addConnection
in classBrokerFilter
- 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 interfaceRegion
- Overrides:
addConsumer
in classBrokerFilter
- Parameters:
context
- the environment the operation is being executed under.- 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 interfaceBroker
- Overrides:
addDestinationInfo
in classBrokerFilter
- Throws:
Exception
-
addProducer
public void addProducer(ConnectionContext context, ProducerInfo info) throws Exception
Description copied from interface:Broker
Adds a producer.- Specified by:
addProducer
in interfaceBroker
- Specified by:
addProducer
in interfaceRegion
- Overrides:
addProducer
in classBrokerFilter
- Parameters:
context
- the environment the operation is being executed under.- Throws:
Exception
- TODO
-
addSession
public void addSession(ConnectionContext context, SessionInfo info) throws Exception
Description copied from interface:Broker
Adds a session.- Specified by:
addSession
in interfaceBroker
- Overrides:
addSession
in classBrokerFilter
- 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 interfaceBroker
- Overrides:
beginTransaction
in classBrokerFilter
- 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 interfaceBroker
- Overrides:
commitTransaction
in classBrokerFilter
- Throws:
Exception
- TODO
-
forgetTransaction
public void forgetTransaction(ConnectionContext context, TransactionId xid) throws Exception
Description copied from interface:Broker
Forgets a transaction.- Specified by:
forgetTransaction
in interfaceBroker
- Overrides:
forgetTransaction
in classBrokerFilter
- Throws:
Exception
-
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 interfaceRegion
- Overrides:
messagePull
in classBrokerFilter
- Throws:
Exception
-
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 interfaceBroker
- Overrides:
prepareTransaction
in classBrokerFilter
- Returns:
- id
- Throws:
Exception
- TODO
-
postProcessDispatch
public void postProcessDispatch(MessageDispatch messageDispatch)
Description copied from interface:Broker
Notify the Broker that a dispatch has happened- Specified by:
postProcessDispatch
in interfaceBroker
- Overrides:
postProcessDispatch
in classBrokerFilter
-
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 interfaceRegion
- Overrides:
processDispatchNotification
in classBrokerFilter
- 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 interfaceBroker
- Overrides:
removeConnection
in classBrokerFilter
- 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 interfaceRegion
- Overrides:
removeConsumer
in classBrokerFilter
- Parameters:
context
- the environment the operation is being executed under.- 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 interfaceRegion
- Overrides:
removeDestination
in 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
-
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 interfaceBroker
- Overrides:
removeDestinationInfo
in classBrokerFilter
- Throws:
Exception
-
removeProducer
public void removeProducer(ConnectionContext context, ProducerInfo info) throws Exception
Description copied from interface:Broker
Removes a producer.- Specified by:
removeProducer
in interfaceBroker
- Specified by:
removeProducer
in interfaceRegion
- Overrides:
removeProducer
in classBrokerFilter
- Parameters:
context
- the environment the operation is being executed under.- 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 interfaceBroker
- Overrides:
removeSession
in classBrokerFilter
- 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 interfaceRegion
- Overrides:
removeSubscription
in classBrokerFilter
- Parameters:
context
- the environment the operation is being executed under.info
- TODO- 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 interfaceBroker
- Overrides:
rollbackTransaction
in classBrokerFilter
- Throws:
Exception
- TODO
-
getWireFormat
public WireFormat getWireFormat()
-
createWireFormat
protected WireFormat createWireFormat()
-
setWireFormat
public void setWireFormat(WireFormat wireFormat)
-
getWireFormatFactory
public WireFormatFactory getWireFormatFactory()
-
createWireFormatFactory
protected OpenWireFormatFactory createWireFormatFactory()
-
setWireFormatFactory
public void setWireFormatFactory(WireFormatFactory wireFormatFactory)
-
createSocketAddress
protected SocketAddress createSocketAddress(URI location) throws UnknownHostException
- Throws:
UnknownHostException
-
getDestination
public URI getDestination()
-
setDestination
public void setDestination(URI destination)
-
getMaxTraceDatagramSize
public int getMaxTraceDatagramSize()
-
setMaxTraceDatagramSize
public void setMaxTraceDatagramSize(int maxTraceDatagramSize)
-
isBroadcast
public boolean isBroadcast()
-
setBroadcast
public void setBroadcast(boolean broadcast)
-
getAddress
public SocketAddress getAddress()
-
setAddress
public void setAddress(SocketAddress address)
-
-