|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.qpid.client.util.BlockingWaiter<org.apache.qpid.protocol.AMQMethodEvent>
org.apache.qpid.client.protocol.BlockingMethodFrameListener
public abstract class BlockingMethodFrameListener
BlockingMethodFrameListener is a 'rendezvous' which acts as a AMQMethodListener
that delegates handling of
incoming methods to a method listener implemented as a sub-class of this and hands off the processed method or
error to a consumer. The producer of the event does not have to wait for the consumer to take the event, so this
differs from a 'rendezvous' in that sense.
processMethod(int, org.apache.qpid.framing.AMQMethodBody)
must return true on any incoming method that it handles. This indicates to
this listeners that the method it is waiting for has arrived. Incoming methods are also filtered by channel prior to
being passed to the processMethod(int, org.apache.qpid.framing.AMQMethodBody)
method, so responses are only received for a particular channel. The
channel id must be passed to the constructor.
Errors from the producer are rethrown to the consumer.
Responsibilities | Collaborations |
---|---|
Accept notification of AMQP method events. | AMQMethodEvent
|
Delegate handling of the method to another method listener. | AMQMethodBody
|
Block until a method is handled by the delegated to handler. | |
Propagate the most recent exception to the consumer. |
Field Summary | |
---|---|
protected int |
_channelId
Holds the channel id for the channel upon which this listener is waiting for a response. |
Fields inherited from class org.apache.qpid.client.util.BlockingWaiter |
---|
_doneObject |
Constructor Summary | |
---|---|
BlockingMethodFrameListener(int channelId)
Creates a new method listener, that filters incoming method to just those that match the specified channel id. |
Method Summary | |
---|---|
org.apache.qpid.protocol.AMQMethodEvent |
blockForFrame(long timeout)
Blocks until a method is received that is handled by the delegated to method listener, or the specified timeout has passed. |
boolean |
methodReceived(org.apache.qpid.protocol.AMQMethodEvent evt)
Informs this listener that an AMQP method has been received. |
boolean |
process(org.apache.qpid.protocol.AMQMethodEvent evt)
Delegates processing of the incomming object to the handler. |
abstract boolean |
processMethod(int channelId,
org.apache.qpid.framing.AMQMethodBody frame)
Delegates any additional handling of the incoming methods to another handler. |
Methods inherited from class org.apache.qpid.client.util.BlockingWaiter |
---|
block, close, error, received |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.qpid.protocol.AMQMethodListener |
---|
error |
Field Detail |
---|
protected int _channelId
Constructor Detail |
---|
public BlockingMethodFrameListener(int channelId)
channelId
- The channel id to filter incoming methods with.Method Detail |
---|
public abstract boolean processMethod(int channelId, org.apache.qpid.framing.AMQMethodBody frame)
channelId
- The channel id of the incoming method.frame
- The method body.
public boolean process(org.apache.qpid.protocol.AMQMethodEvent evt)
BlockingWaiter
process
in class BlockingWaiter<org.apache.qpid.protocol.AMQMethodEvent>
evt
- The object to process.
public boolean methodReceived(org.apache.qpid.protocol.AMQMethodEvent evt)
methodReceived
in interface org.apache.qpid.protocol.AMQMethodListener
evt
- The AMQP method.
public org.apache.qpid.protocol.AMQMethodEvent blockForFrame(long timeout) throws org.apache.qpid.AMQException, FailoverException
timeout
- The timeout in milliseconds.
org.apache.qpid.AMQException
FailoverException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |