com.rabbitmq.tools
Class Tracer

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

public class Tracer
extends java.lang.Object
implements java.lang.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

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:
Tracer.Logger, Tracer.AsyncLogger

Nested Class Summary
static class Tracer.AsyncLogger
          A Tracer.Logger designed to print Strings to a designated OutputStream on a private thread.
static interface Tracer.Logger
          Logging strings to an outputStream.
 
Constructor Summary
Tracer(int listenPort, java.lang.String id, java.lang.String host, int port, Tracer.Logger logger, java.util.Properties props)
           
Tracer(java.lang.String id)
           
Tracer(java.lang.String id, java.util.Properties props)
           
 
Method Summary
 void log(java.lang.String message)
           
 void logException(java.lang.Exception e)
           
static void main(java.lang.String[] args)
           
 void run()
           
 void start()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tracer

public Tracer(int listenPort,
              java.lang.String id,
              java.lang.String host,
              int port,
              Tracer.Logger logger,
              java.util.Properties props)
       throws java.io.IOException
Throws:
java.io.IOException

Tracer

public Tracer(java.lang.String id)
       throws java.io.IOException
Throws:
java.io.IOException

Tracer

public Tracer(java.lang.String id,
              java.util.Properties props)
       throws java.io.IOException
Throws:
java.io.IOException
Method Detail

main

public static void main(java.lang.String[] args)

start

public void start()

run

public void run()
Specified by:
run in interface java.lang.Runnable

log

public void log(java.lang.String message)

logException

public void logException(java.lang.Exception e)