org.apache.activemq.broker.util
Class UDPTraceBrokerPlugin

java.lang.Object
  extended by org.apache.activemq.broker.MutableBrokerFilter
      extended by org.apache.activemq.broker.BrokerPluginSupport
          extended by 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
protected  java.net.SocketAddress address
           
protected  boolean broadcast
           
protected  BrokerId brokerId
           
protected  java.net.URI destination
           
protected  int maxTraceDatagramSize
           
protected  java.net.DatagramSocket socket
           
protected  WireFormat wireFormat
           
protected  WireFormatFactory wireFormatFactory
           
 
Fields inherited from class org.apache.activemq.broker.MutableBrokerFilter
next
 
Constructor Summary
UDPTraceBrokerPlugin()
           
 
Method Summary
 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 object
 void 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  java.net.DatagramSocket createSocket()
           
protected  java.net.SocketAddress createSocketAddress(java.net.URI location)
           
protected  WireFormat createWireFormat()
           
protected  OpenWireFormatFactory createWireFormatFactory()
           
 void forgetTransaction(ConnectionContext context, TransactionId xid)
          Forgets a transaction.
 java.net.SocketAddress getAddress()
           
 java.net.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 queue
 void postProcessDispatch(MessageDispatch messageDispatch)
          Notify the Broker that a dispatch has happened
 int prepareTransaction(ConnectionContext context, TransactionId xid)
          Prepares a transaction.
 void processDispatchNotification(MessageDispatchNotification messageDispatchNotification)
          Process a notification of a dispatch - used by a Slave Broker
 void removeConnection(ConnectionContext context, ConnectionInfo info, java.lang.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 setAddress(java.net.SocketAddress address)
           
 void setBroadcast(boolean broadcast)
           
 void setDestination(java.net.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
addBroker, addDestination, brokerServiceStarted, fastProducer, gc, getAdaptor, getAdminConnectionContext, getBrokerId, getBrokerName, getBrokerSequenceId, getBrokerService, getClients, getDestinationMap, getDestinations, getDestinations, getDurableDestinations, getExecutor, getNext, getPeerBrokerInfos, getPreparedTransactions, getRoot, getScheduler, getTempDataStore, getVmConnectorURI, isExpired, isFaultTolerantConfiguration, isFull, isStopped, messageConsumed, messageDelivered, messageDiscarded, messageExpired, networkBridgeStarted, networkBridgeStopped, nowMasterBroker, preProcessDispatch, processConsumerControl, removeBroker, sendToDeadLetterQueue, setAdminConnectionContext, setNext, slowConsumer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wireFormat

protected WireFormat wireFormat

wireFormatFactory

protected WireFormatFactory wireFormatFactory

maxTraceDatagramSize

protected int maxTraceDatagramSize

destination

protected java.net.URI destination

socket

protected java.net.DatagramSocket socket

brokerId

protected BrokerId brokerId

address

protected java.net.SocketAddress address

broadcast

protected boolean broadcast
Constructor Detail

UDPTraceBrokerPlugin

public UDPTraceBrokerPlugin()
Method Detail

start

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

createSocket

protected java.net.DatagramSocket createSocket()
                                        throws java.io.IOException
Throws:
java.io.IOException

stop

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

send

public void send(ProducerBrokerExchange producerExchange,
                 Message messageSend)
          throws java.lang.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:
java.lang.Exception - TODO

acknowledge

public void acknowledge(ConsumerBrokerExchange consumerExchange,
                        MessageAck ack)
                 throws java.lang.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:
java.lang.Exception - TODO

addConnection

public void addConnection(ConnectionContext context,
                          ConnectionInfo info)
                   throws java.lang.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:
java.lang.Exception - TODO

addConsumer

public Subscription addConsumer(ConnectionContext context,
                                ConsumerInfo info)
                         throws java.lang.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:
java.lang.Exception - TODO

addDestinationInfo

public void addDestinationInfo(ConnectionContext context,
                               DestinationInfo info)
                        throws java.lang.Exception
Description copied from interface: Broker
Add and process a DestinationInfo object

Specified by:
addDestinationInfo in interface Broker
Overrides:
addDestinationInfo in class MutableBrokerFilter
Throws:
java.lang.Exception

addProducer

public void addProducer(ConnectionContext context,
                        ProducerInfo info)
                 throws java.lang.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:
java.lang.Exception - TODO

addSession

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

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

beginTransaction

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

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

commitTransaction

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

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

forgetTransaction

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

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

messagePull

public Response messagePull(ConnectionContext context,
                            MessagePull pull)
                     throws java.lang.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:
java.lang.Exception

prepareTransaction

public int prepareTransaction(ConnectionContext context,
                              TransactionId xid)
                       throws java.lang.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:
java.lang.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 interface Broker
Overrides:
postProcessDispatch in class MutableBrokerFilter

processDispatchNotification

public void processDispatchNotification(MessageDispatchNotification messageDispatchNotification)
                                 throws java.lang.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:
java.lang.Exception - TODO

removeConnection

public void removeConnection(ConnectionContext context,
                             ConnectionInfo info,
                             java.lang.Throwable error)
                      throws java.lang.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:
java.lang.Exception - TODO

removeConsumer

public void removeConsumer(ConnectionContext context,
                           ConsumerInfo info)
                    throws java.lang.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:
java.lang.Exception - TODO

removeDestination

public void removeDestination(ConnectionContext context,
                              ActiveMQDestination destination,
                              long timeout)
                       throws java.lang.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:
java.lang.Exception - TODO

removeDestinationInfo

public void removeDestinationInfo(ConnectionContext context,
                                  DestinationInfo info)
                           throws java.lang.Exception
Description copied from interface: Broker
Remove and process a DestinationInfo object

Specified by:
removeDestinationInfo in interface Broker
Overrides:
removeDestinationInfo in class MutableBrokerFilter
Throws:
java.lang.Exception

removeProducer

public void removeProducer(ConnectionContext context,
                           ProducerInfo info)
                    throws java.lang.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:
java.lang.Exception - TODO

removeSession

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

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

removeSubscription

public void removeSubscription(ConnectionContext context,
                               RemoveSubscriptionInfo info)
                        throws java.lang.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:
java.lang.Exception - TODO

rollbackTransaction

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

Specified by:
rollbackTransaction in interface Broker
Overrides:
rollbackTransaction in class MutableBrokerFilter
Throws:
java.lang.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 java.net.SocketAddress createSocketAddress(java.net.URI location)
                                              throws java.net.UnknownHostException
Throws:
java.net.UnknownHostException

getDestination

public java.net.URI getDestination()

setDestination

public void setDestination(java.net.URI destination)

getMaxTraceDatagramSize

public int getMaxTraceDatagramSize()

setMaxTraceDatagramSize

public void setMaxTraceDatagramSize(int maxTraceDatagramSize)

isBroadcast

public boolean isBroadcast()

setBroadcast

public void setBroadcast(boolean broadcast)

getAddress

public java.net.SocketAddress getAddress()

setAddress

public void setAddress(java.net.SocketAddress address)


Copyright © 2005-2011 FuseSource, Corp.. All Rights Reserved.