org.apache.qpid.testkit
Class Receiver

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

public class Receiver
extends Client
implements MessageListener

A generic receiver which consumes messages from a given address in a broker (host/port) until told to stop by killing it. It participates in a feedback loop to ensure the producer doesn't fill up the queue. If it receives an "End" msg it sends a reply to the replyTo address in that msg. 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. sync_rcv - Whether to consume sync (instead of using a listener). report_frequency - how often a timestamp is printed durable transacted tx_size - size of transaction batch in # msgs. * check_for_dups - check for duplicate messages and out of order messages. jms_durable_sub - create a durable subscription instead of a regular subscription.


Field Summary
(package private)  boolean checkForDups
           
(package private)  MessageConsumer consumer
           
(package private)  List<Integer> duplicateMessages
           
(package private)  boolean jmsDurableSub
           
(package private)  long msg_count
           
(package private)  int sequence
           
(package private)  boolean syncRcv
           
 
Constructor Summary
Receiver(Connection con, String addr)
           
 
Method Summary
static void main(String[] args)
           
 void onMessage(Message msg)
           
 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_count

long msg_count

sequence

int sequence

syncRcv

boolean syncRcv

jmsDurableSub

boolean jmsDurableSub

checkForDups

boolean checkForDups

consumer

MessageConsumer consumer

duplicateMessages

List<Integer> duplicateMessages
Constructor Detail

Receiver

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

onMessage

public void onMessage(Message msg)
Specified by:
onMessage in interface MessageListener

run

public void run()
         throws Exception
Throws:
Exception

main

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


Licensed to the Apache Software Foundation