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
-
-
Field Summary
-
Fields inherited from class org.apache.qpid.protonj2.engine.impl.ProtonLink
connection, localAttach, remoteAttach, session
-
Fields inherited from class org.apache.qpid.protonj2.engine.impl.ProtonEndpoint
engine
-
-
Constructor Summary
Constructors Constructor Description ProtonReceiver(ProtonSession session, java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProtonReceiveraddCredit(int credit)Adds the given amount of credit for theReceiver.ReceivercreditStateUpdateHandler(EventHandler<Receiver> handler)Handler for link credit updates that occur after a remoteFlowarrives.protected ProtonReceiverdecorateOutgoingFlow(Flow flow)ReceiverdeliveryAbortedHandler(EventHandler<IncomingDelivery> handler)Handler for aborted deliveries that is called for each aborted in-progress delivery.ReceiverdeliveryReadHandler(EventHandler<IncomingDelivery> handler)ReceiverdeliveryStateUpdatedHandler(EventHandler<IncomingDelivery> handler)Handler for updates to the remote state of incoming deliveries that have previously been received.Receiverdisposition(java.util.function.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.intgetCredit()Get the credit that is currently available or assigned to this link.DeliveryStategetDefaultDeliveryState()RolegetRole()protected ProtonReceiverhandleRemoteAttach(Attach attach)protected ProtonReceiverhandleRemoteDetach(Detach detach)protected ProtonReceiverhandleRemoteDisposition(Disposition disposition, ProtonIncomingDelivery delivery)protected ProtonReceiverhandleRemoteDisposition(Disposition disposition, ProtonOutgoingDelivery delivery)protected ProtonReceiverhandleRemoteFlow(Flow flow)protected ProtonIncomingDeliveryhandleRemoteTransfer(Transfer transfer, ProtonBuffer payload)booleanhasUnsettled()booleanisDraining()Indicates if the link is draining.protected ProtonReceiverself()ProtonReceiversetDefaultDeliveryState(DeliveryState state)Configures a default DeliveryState to be used if a received delivery is settled/freed without any disposition state having been previously applied.Receiversettle(java.util.function.Predicate<IncomingDelivery> filter)For each unsettled outgoing delivery that is pending in theReceiverapply the given predicate and if it matches then settle the delivery.java.util.Collection<IncomingDelivery>unsettled()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, transitionToRemotelyOpenedState
-
Methods inherited from class org.apache.qpid.protonj2.engine.impl.ProtonEndpoint
closeHandler, engineShutdownHandler, getAttachments, getCondition, getEngine, getLinkedResource, getLinkedResource, getRemoteCondition, localCloseHandler, localOpenHandler, openHandler, setCondition, setLinkedResource
-
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.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, setProperties
-
Methods 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 Detail
-
ProtonReceiver
public ProtonReceiver(ProtonSession session, java.lang.String name)
- Parameters:
session- The Session that is linked to this receiver instance.name- The name assigned to thisReceiverlink.
-
-
Method Detail
-
setDefaultDeliveryState
public ProtonReceiver setDefaultDeliveryState(DeliveryState state)
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
public DeliveryState getDefaultDeliveryState()
- Specified by:
getDefaultDeliveryStatein interfaceReceiver- Returns:
- the default delivery state for this delivery
-
getRole
public Role getRole()
-
self
protected ProtonReceiver 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
public ProtonReceiver addCredit(int credit)
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(java.util.function.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
public Receiver settle(java.util.function.Predicate<IncomingDelivery> filter)
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
public java.util.Collection<IncomingDelivery> 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
public Receiver deliveryReadHandler(EventHandler<IncomingDelivery> handler)
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
public Receiver deliveryAbortedHandler(EventHandler<IncomingDelivery> handler)
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
public Receiver deliveryStateUpdatedHandler(EventHandler<IncomingDelivery> handler)
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
public Receiver creditStateUpdateHandler(EventHandler<Receiver> handler)
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
protected final ProtonReceiver handleRemoteAttach(Attach attach)
- Specified by:
handleRemoteAttachin classProtonLink<Receiver>
-
handleRemoteDetach
protected final ProtonReceiver handleRemoteDetach(Detach detach)
- Specified by:
handleRemoteDetachin classProtonLink<Receiver>
-
handleRemoteFlow
protected final ProtonReceiver handleRemoteFlow(Flow flow)
- 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
protected ProtonReceiver decorateOutgoingFlow(Flow flow)
- Specified by:
decorateOutgoingFlowin classProtonLink<Receiver>
-
-