org.apache.qpid.testkit
Class Sender

java.lang.Object
  extended by org.apache.qpid.testkit.Client
      extended by org.apache.qpid.testkit.Sender
All Implemented Interfaces:
ExceptionListener

public class Sender
extends Client

A generic sender which sends a stream of messages to a given address in a broker (host/port) until told to stop by killing it. It has a feedback loop to ensure it doesn't fill up queues due to a slow consumer. It doesn't check for correctness or measure anything leaving those concerns to another entity. However it prints a timestamp every x secs(-Dreport_frequency) as checkpoint to figure out how far the test has progressed if a failure occurred. It also takes in an optional Error handler to pass out any error in addition to writing them to std err. This is intended more as building block to create more complex test cases. However there is a main method provided to use this standalone. The following options are available and configurable via jvm args. msg_size (256) msg_count (10) - # messages before waiting for feedback sleep_time (1000 ms) - sleep time btw each iteration report_frequency - how often a timestamp is printed durable transacted tx_size - size of transaction batch in # msgs.


Field Summary
protected  Destination dest
           
protected  DateFormat df
           
(package private)  Random gen
           
protected  int iterations
           
protected  int msg_count
           
protected  int msg_size
           
protected  NumberFormat nf
           
protected  MessageProducer producer
           
protected  Destination replyTo
           
protected  long sleep_time
           
 
Constructor Summary
Sender(Connection con, String addr)
           
 
Method Summary
protected  Message getNextMessage()
           
static void main(String[] args)
           
 void run()
           
 
Methods inherited from class org.apache.qpid.testkit.Client
close, getAck_mode, getContentType, getDf, getReportFrequency, getSsn, getStartTime, getTxSize, handleError, isDurable, isTransacted, onException, setErrorHandler, setSsn, setStartTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

msg_size

protected int msg_size

msg_count

protected int msg_count

iterations

protected int iterations

sleep_time

protected long sleep_time

dest

protected Destination dest

replyTo

protected Destination replyTo

df

protected DateFormat df

nf

protected NumberFormat nf

producer

protected MessageProducer producer

gen

Random gen
Constructor Detail

Sender

public Sender(Connection con,
              String addr)
       throws Exception
Throws:
Exception
Method Detail

getNextMessage

protected Message getNextMessage()
                          throws Exception
Throws:
Exception

run

public void run()

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception


Licensed to the Apache Software Foundation