Class ProtonReceiver
java.lang.Object
org.apache.qpid.protonj2.engine.impl.ProtonEndpoint<L>
org.apache.qpid.protonj2.engine.impl.ProtonLink<Receiver>
org.apache.qpid.protonj2.engine.impl.ProtonReceiver
Proton Receiver link implementation.
-
Field Summary
Fields inherited from class org.apache.qpid.protonj2.engine.impl.ProtonLink
connection, localAttach, remoteAttach, sessionFields inherited from class org.apache.qpid.protonj2.engine.impl.ProtonEndpoint
engine -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddCredit(int credit) Adds the given amount of credit for theReceiver.creditStateUpdateHandler(EventHandler<Receiver> handler) Handler for link credit updates that occur after a remoteFlowarrives.protected ProtonReceiverdecorateOutgoingFlow(Flow flow) Handler for aborted deliveries that is called for each aborted in-progress delivery.deliveryReadHandler(EventHandler<IncomingDelivery> handler) Handler for updates to the remote state of incoming deliveries that have previously been received.disposition(Predicate<IncomingDelivery> filter, DeliveryState disposition, boolean settle) For each unsettled outgoing delivery that is pending in theReceiverapply the given predicate and if it matches then apply the given delivery state and settled value to it.booleandrain()Initiate a drain of all remaining credit of thisReceiverlink.booleandrain(int credits) Initiate a drain of the given credit from this thisReceiverlink.intGet the credit that is currently available or assigned to this link.getRole()protected final ProtonReceiverhandleRemoteAttach(Attach attach) protected final ProtonReceiverhandleRemoteDetach(Detach detach) protected final ProtonReceiverhandleRemoteDisposition(Disposition disposition, ProtonIncomingDelivery delivery) protected final ProtonReceiverhandleRemoteDisposition(Disposition disposition, ProtonOutgoingDelivery delivery) protected final ProtonReceiverhandleRemoteFlow(Flow flow) protected final ProtonIncomingDeliveryhandleRemoteTransfer(Transfer transfer, ProtonBuffer payload) booleanbooleanIndicates if the link is draining.protected ProtonReceiverself()Configures a default DeliveryState to be used if a received delivery is settled/freed without any disposition state having been previously applied.settle(Predicate<IncomingDelivery> filter) For each unsettled outgoing delivery that is pending in theReceiverapply the given predicate and if it matches then settle the delivery.Retrieves the list of unsettled deliveries for thisReceiverlink which have yet to be settled on this end of the link.Methods inherited from class org.apache.qpid.protonj2.engine.impl.ProtonLink
areDeliveriesStillActive, checkLinkOperable, checkNotClosed, checkNotOpened, close, detach, detachHandler, getConnection, getDesiredCapabilities, getMaxMessageSize, getName, getOfferedCapabilities, getParent, getProperties, getReceiverSettleMode, getRemoteDesiredCapabilities, getRemoteMaxMessageSize, getRemoteOfferedCapabilities, getRemoteProperties, getRemoteReceiverSettleMode, getRemoteSenderSettleMode, getRemoteSource, getRemoteState, getRemoteTarget, getSenderSettleMode, getSession, getSource, getState, getTarget, isLocallyClosed, isLocallyClosedOrDetached, isLocallyDetached, isLocallyOpen, isReceiver, isRemotelyClosed, isRemotelyClosedOrDetached, isRemotelyDetached, isRemotelyOpen, isSender, localDetachHandler, open, parentEndpointClosedHandler, setDesiredCapabilities, setMaxMessageSize, setOfferedCapabilities, setProperties, setReceiverSettleMode, setSenderSettleMode, setSource, setTarget, setTarget, transitionedToLocallyClosed, transitionedToLocallyDetached, transitionedToLocallyOpened, transitionToParentLocallyClosed, transitionToParentRemotelyClosed, transitionToRemotelyClosed, transitionToRemotelyDetached, transitionToRemotelyOpenedStateMethods inherited from class org.apache.qpid.protonj2.engine.impl.ProtonEndpoint
closeHandler, engineShutdownHandler, getAttachments, getCondition, getEngine, getLinkedResource, getLinkedResource, getRemoteCondition, localCloseHandler, localOpenHandler, openHandler, setCondition, setLinkedResourceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.qpid.protonj2.engine.Endpoint
close, closeHandler, engineShutdownHandler, getAttachments, getCondition, getDesiredCapabilities, getEngine, getLinkedResource, getLinkedResource, getOfferedCapabilities, getProperties, getRemoteCondition, getRemoteDesiredCapabilities, getRemoteOfferedCapabilities, getRemoteProperties, isLocallyClosed, isLocallyOpen, localCloseHandler, localOpenHandler, open, openHandler, setCondition, setDesiredCapabilities, setLinkedResource, setOfferedCapabilities, setPropertiesMethods inherited from interface org.apache.qpid.protonj2.engine.Link
detach, detachHandler, getConnection, getMaxMessageSize, getName, getParent, getReceiverSettleMode, getRemoteMaxMessageSize, getRemoteReceiverSettleMode, getRemoteSenderSettleMode, getRemoteSource, getRemoteState, getRemoteTarget, getSenderSettleMode, getSession, getSource, getState, getTarget, isLocallyClosedOrDetached, isLocallyDetached, isReceiver, isRemotelyClosed, isRemotelyClosedOrDetached, isRemotelyDetached, isRemotelyOpen, isSender, localDetachHandler, parentEndpointClosedHandler, setMaxMessageSize, setReceiverSettleMode, setSenderSettleMode, setSource, setTarget, setTarget
-
Constructor Details
-
ProtonReceiver
- Parameters:
session- The Session that is linked to this receiver instance.name- The name assigned to thisReceiverlink.
-
-
Method Details
-
setDefaultDeliveryState
Description copied from interface:ReceiverConfigures a default DeliveryState to be used if a received delivery is settled/freed without any disposition state having been previously applied.- Specified by:
setDefaultDeliveryStatein interfaceReceiver- Parameters:
state- the default delivery state- Returns:
- this
Receiverfor chaining.
-
getDefaultDeliveryState
- Specified by:
getDefaultDeliveryStatein interfaceReceiver- Returns:
- the default delivery state for this delivery
-
getRole
-
self
- Specified by:
selfin classProtonLink<Receiver>
-
getCredit
public int getCredit()Description copied from interface:LinkGet the credit that is currently available or assigned to this link. -
addCredit
Description copied from interface:ReceiverAdds the given amount of credit for theReceiver. -
drain
public boolean drain()Description copied from interface:ReceiverInitiate a drain of all remaining credit of thisReceiverlink. -
drain
public boolean drain(int credits) Description copied from interface:ReceiverInitiate a drain of the given credit from this thisReceiverlink. If the credit given is greater than the current link credit the current credit is increased, however if the amount of credit given is less that the current amount of link credit an exception is thrown. -
isDraining
public boolean isDraining()Description copied from interface:LinkIndicates if the link is draining. For aSenderlink this indicates that the remote has requested that the Sender transmit deliveries up to the currently available credit or indicate that it has no more to send. For aReceiverthis indicates that the Receiver has requested that the Sender consume its outstanding credit.- Specified by:
isDrainingin interfaceLink<Receiver>- Returns:
- true if the
Linkis currently marked as draining.
-
disposition
public Receiver disposition(Predicate<IncomingDelivery> filter, DeliveryState disposition, boolean settle) Description copied from interface:ReceiverFor each unsettled outgoing delivery that is pending in theReceiverapply the given predicate and if it matches then apply the given delivery state and settled value to it.- Specified by:
dispositionin interfaceReceiver- Parameters:
filter- The predicate to apply to each unsettled delivery to test for a match.disposition- The newDeliveryStateto apply to any matching outgoing deliveries.settle- Boolean indicating if the matching unsettled deliveries should be settled.- Returns:
- this
Receiverfor chaining
-
settle
Description copied from interface:ReceiverFor each unsettled outgoing delivery that is pending in theReceiverapply the given predicate and if it matches then settle the delivery. -
unsettled
Description copied from interface:ReceiverRetrieves the list of unsettled deliveries for thisReceiverlink which have yet to be settled on this end of the link. When theIncomingDeliveryis settled by the receiver the value will be removed from the collection. TheCollectionreturned from this method is a copy of the internally maintained data and is not modifiable. The caller should use this method judiciously to avoid excess GC overhead. -
hasUnsettled
public boolean hasUnsettled()- Specified by:
hasUnsettledin interfaceReceiver- Returns:
- true if there are unsettled deliveries for this
Receiverlink.
-
deliveryReadHandler
Description copied from interface:ReceiverHandler for incoming deliveries that is called for each incomingTransferframe that comprises either one complete delivery or a chunk of a split framedTransfer. The handler should check that the delivery being read is partial or not and act accordingly, as partial deliveries expect additional updates as more frames comprising thatIncomingDeliveryarrive or the remote aborts the transfer.- Specified by:
deliveryReadHandlerin interfaceReceiver- Parameters:
handler- The handler that will be invoked whenTransferframes arrive on this receiver link.- Returns:
- this receiver
-
deliveryAbortedHandler
Description copied from interface:ReceiverHandler for aborted deliveries that is called for each aborted in-progress delivery.This handler is an optional convenience handler that supplements the standard
Receiver.deliveryReadHandler(EventHandler)in cases where the users wishes to break out the processing of inbound delivery data from abort processing. If this handler is not set theReceiverwill call the registeredReceiver.deliveryAbortedHandler(EventHandler)if one is set.- Specified by:
deliveryAbortedHandlerin interfaceReceiver- Parameters:
handler- The handler that will be invoked whenTransferframes arrive on this receiver link.- Returns:
- this receiver
-
deliveryStateUpdatedHandler
Description copied from interface:ReceiverHandler for updates to the remote state of incoming deliveries that have previously been received.Remote state updates for an
IncomingDeliverycan happen when the remote settles a completeIncomingDeliveryor otherwise modifies the delivery outcome and the user needs to act on those changes such as a spontaneous update to theDeliveryState.- Specified by:
deliveryStateUpdatedHandlerin interfaceReceiver- Parameters:
handler- The handler that will be invoked when a new remote state update for anIncomingDeliveryarrives on this link.- Returns:
- this receiver
-
creditStateUpdateHandler
Description copied from interface:LinkHandler for link credit updates that occur after a remoteFlowarrives.- Specified by:
creditStateUpdateHandlerin interfaceLink<Receiver>- Parameters:
handler- An event handler that will be signaled when the link credit is updated by a remote flow.- Returns:
- the
Linkfor chaining.
-
handleRemoteAttach
- Specified by:
handleRemoteAttachin classProtonLink<Receiver>
-
handleRemoteDetach
- Specified by:
handleRemoteDetachin classProtonLink<Receiver>
-
handleRemoteFlow
- Specified by:
handleRemoteFlowin classProtonLink<Receiver>
-
handleRemoteDisposition
protected final ProtonReceiver handleRemoteDisposition(Disposition disposition, ProtonIncomingDelivery delivery) - Specified by:
handleRemoteDispositionin classProtonLink<Receiver>
-
handleRemoteDisposition
protected final ProtonReceiver handleRemoteDisposition(Disposition disposition, ProtonOutgoingDelivery delivery) - Specified by:
handleRemoteDispositionin classProtonLink<Receiver>
-
handleRemoteTransfer
protected final ProtonIncomingDelivery handleRemoteTransfer(Transfer transfer, ProtonBuffer payload) - Specified by:
handleRemoteTransferin classProtonLink<Receiver>
-
decorateOutgoingFlow
- Specified by:
decorateOutgoingFlowin classProtonLink<Receiver>
-