public class

Tracer

extends Object
implements Runnable
java.lang.Object
   ↳ com.rabbitmq.tools.Tracer

Class Overview

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()) 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 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.

Summary

Nested Classes
class Tracer.AsyncLogger A Tracer.Logger designed to print Strings to a designated OutputStream on a private thread. 
interface Tracer.Logger Logging strings to an outputStream. 
Public Constructors
Tracer(int listenPort, String id, String host, int port, Tracer.Logger logger, Properties props)
Tracer(String id)
Tracer(String id, Properties props)
Public Methods
void log(String message)
void logException(Exception e)
static void main(String[] args)
void run()
void start()
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.lang.Runnable

Public Constructors

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

Throws
IOException

public Tracer (String id)

Throws
IOException

public Tracer (String id, Properties props)

Throws
IOException

Public Methods

public void log (String message)

public void logException (Exception e)

public static void main (String[] args)

public void run ()

public void start ()