org.apache.qpid.test.framework
Class CircuitEndBase

java.lang.Object
  extended by org.apache.qpid.test.framework.CircuitEndBase
All Implemented Interfaces:
CircuitEnd
Direct Known Subclasses:
LocalPublisherImpl, LocalReceiverImpl

public class CircuitEndBase
extends Object
implements CircuitEnd

A CircuitEndBase is a pair consisting of one message producer and one message consumer, that represents one end of a test circuit. It is a standard unit of connectivity allowing a full-duplex conversation to be held, provided both the consumer and producer are instantiated and configured.

CRC Card
Responsibilities
Provide a message producer for sending messages.
Provide a message consumer for receiving messages.


Field Summary
(package private)  MessageConsumer consumer
          Holds the single message consumer.
(package private)  ExceptionMonitor exceptionMonitor
          Holds the exception monitor for the circuit end.
(package private)  MessageMonitor messageMonitor
          Holds the message monitor for the circuit end.
(package private)  MessageProducer producer
          Holds the single message producer.
(package private)  Session session
          Holds the controlSession for the circuit end.
 
Constructor Summary
CircuitEndBase(MessageProducer producer, MessageConsumer consumer, Session session, MessageMonitor messageMonitor, ExceptionMonitor exceptionMonitor)
          Creates a circuit end point on the specified producer, consumer and controlSession.
 
Method Summary
 void close()
          Closes the message producers and consumers and the sessions, associated with this circuit end point.
 MessageConsumer getConsumer()
          Gets the message consumer at this circuit end point.
 ExceptionMonitor getExceptionMonitor()
          Returns the exception monitor for reporting on exceptions received on this circuit end.
 MessageMonitor getMessageMonitor()
          Returns the message monitor for reporting on received messages on this circuit end.
 MessageProducer getProducer()
          Gets the message producer at this circuit end point.
 Session getSession()
          Gets the JMS Session associated with this circuit end point.
 void send(Message message)
          Send the specified message over the producer at this end point.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

producer

MessageProducer producer
Holds the single message producer.


consumer

MessageConsumer consumer
Holds the single message consumer.


session

Session session
Holds the controlSession for the circuit end.


messageMonitor

MessageMonitor messageMonitor
Holds the message monitor for the circuit end.


exceptionMonitor

ExceptionMonitor exceptionMonitor
Holds the exception monitor for the circuit end.

Constructor Detail

CircuitEndBase

public CircuitEndBase(MessageProducer producer,
                      MessageConsumer consumer,
                      Session session,
                      MessageMonitor messageMonitor,
                      ExceptionMonitor exceptionMonitor)
Creates a circuit end point on the specified producer, consumer and controlSession. Monitors are also configured for messages and exceptions received by the circuit end.

Parameters:
producer - The message producer for the circuit end point.
consumer - The message consumer for the circuit end point.
session - The controlSession for the circuit end point.
messageMonitor - The monitor to notify of all messages received by the circuit end.
exceptionMonitor - The monitor to notify of all exceptions received by the circuit end.
Method Detail

getProducer

public MessageProducer getProducer()
Gets the message producer at this circuit end point.

Specified by:
getProducer in interface CircuitEnd
Returns:
The message producer at with this circuit end point.

getConsumer

public MessageConsumer getConsumer()
Gets the message consumer at this circuit end point.

Specified by:
getConsumer in interface CircuitEnd
Returns:
The message consumer at this circuit end point.

send

public void send(Message message)
          throws JMSException
Send the specified message over the producer at this end point.

Specified by:
send in interface CircuitEnd
Parameters:
message - The message to send.
Throws:
JMSException - Any JMS exception occuring during the send is allowed to fall through.

getSession

public Session getSession()
Gets the JMS Session associated with this circuit end point.

Specified by:
getSession in interface CircuitEnd
Returns:
The JMS Session associated with this circuit end point.

close

public void close()
           throws JMSException
Closes the message producers and consumers and the sessions, associated with this circuit end point.

Specified by:
close in interface CircuitEnd
Throws:
JMSException - Any JMSExceptions occurring during the close are allowed to fall through.

getMessageMonitor

public MessageMonitor getMessageMonitor()
Returns the message monitor for reporting on received messages on this circuit end.

Specified by:
getMessageMonitor in interface CircuitEnd
Returns:
The message monitor for this circuit end.

getExceptionMonitor

public ExceptionMonitor getExceptionMonitor()
Returns the exception monitor for reporting on exceptions received on this circuit end.

Specified by:
getExceptionMonitor in interface CircuitEnd
Returns:
The exception monitor for this circuit end.


Licensed to the Apache Software Foundation