Interface Receiver

All Superinterfaces:
Endpoint, Link

public interface Receiver
extends Link


Method Summary
 boolean advance()
          Attempts to advance the current delivery.
 void drain(int credit)
 void flow(int credits)
          Adds the specified number of credits.
 int recv(byte[] bytes, int offset, int size)
          Receive message data for the current delivery.
Methods inherited from interface org.apache.qpid.proton.engine.Link
current, delivery, delivery, getCredit, getName, getQueued, getReceiverSettleMode, getRemoteReceiverSettleMode, getRemoteSenderSettleMode, getRemoteSource, getRemoteTarget, getSenderSettleMode, getSession, getSource, getTarget, getUnsettled, next, setReceiverSettleMode, setRemoteSenderSettleMode, setSenderSettleMode, setSource, setTarget, unsettled
Methods inherited from interface org.apache.qpid.proton.engine.Endpoint
close, free, getCondition, getContext, getLocalState, getRemoteCondition, getRemoteState, open, setCondition, setContext

Method Detail


void flow(int credits)
Adds the specified number of credits. The number of link credits initialises to zero. It is the application's responsibility to call this method to allow the receiver to receive credits more deliveries.


int recv(byte[] bytes,
         int offset,
         int size)
Receive message data for the current delivery. If the caller takes all the bytes the Receiver currently has for this delivery then it is removed from the Connection's work list. Before considering a delivery to be complete, the caller should examine Delivery.isPartial(). If the delivery is partial, the caller should call recv(byte[], int, int) again to receive the additional bytes once the Delivery appears again on the Connection work-list. TODO might the flags other than IO_WORK in DeliveryImpl also prevent the work list being pruned? e.g. what if a slow JMS consumer receives a disposition frame containing state=RELEASED? This is not IO_WORK.

bytes - the destination array where the message data is written
offset - index in the array to start writing data at
size - the maximum number of bytes to write
number of bytes written. -1 if there are no more bytes for the current delivery.
See Also:


void drain(int credit)


boolean advance()
Attempts to advance the current delivery. Advances it to the next delivery if one exists, else null. The behaviour of this method is different for senders and receivers. TODO document what this method conceptually does and when you should use it.

Specified by:
advance in interface Link
true if it can advance, false if it cannot TODO document the meaning of the return value more fully. Currently Senderimpl only returns false if there is no current delivery