Class Tracer

java.lang.Object
com.rabbitmq.tools.Tracer
All Implemented Interfaces:
Runnable

public class Tracer extends Object implements Runnable
AMQP Protocol Analyzer program. Listens on a port (in-port) and when a connection arrives, makes an outbound connection to a host and port (out-port). Relays frames from the in-port to the out-port. Commands are decoded and printed to a supplied Tracer.Logger.

The stand-alone program (main(String[])) prints to System.out, using a private Tracer.AsyncLogger instance. When the connection closes the program listens for a subsequent connection and traces that to the same Tracer.Logger. This continues until the program is interrupted.

Options for controlling, for example, whether command bodies are decoded, are obtained from System.properties, and are reported to the console before starting the trace.

A Tracer object may be instantiated, using one of the constructors

  • Tracer(int listenPort, String id, String host, int port, Logger logger, Properties props)
  • Tracer(String id)
  • Tracer(String id, Properties props)

    where the missing parameters default as follows:

    • listenPort defaults to 5673
    • host defaults to localhost
    • port defaults to 5672
    • logger defaults to new AsyncLogger(System.out)
    • and
    • props defaults to System.getProperties()

These constructors block waiting for a connection to arrive on the listenPort. Tracing does not begin until the tracer is start()ed which Tracer.Logger.start()s the supplied logger and creates and starts a Thread for relaying and deconstructing the frames.

The properties specified in props are used at start() time and may be modified before this call.

See Also: