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 ProtonReceiver
addCredit(int credit)
Adds the given amount of credit for theReceiver
.Receiver
creditStateUpdateHandler(EventHandler<Receiver> handler)
Handler for link credit updates that occur after a remoteFlow
arrives.protected ProtonReceiver
decorateOutgoingFlow(Flow flow)
Receiver
deliveryAbortedHandler(EventHandler<IncomingDelivery> handler)
Handler for aborted deliveries that is called for each aborted in-progress delivery.Receiver
deliveryReadHandler(EventHandler<IncomingDelivery> handler)
Receiver
deliveryStateUpdatedHandler(EventHandler<IncomingDelivery> handler)
Handler for updates to the remote state of incoming deliveries that have previously been received.Receiver
disposition(java.util.function.Predicate<IncomingDelivery> filter, DeliveryState disposition, boolean settle)
For each unsettled outgoing delivery that is pending in theReceiver
apply the given predicate and if it matches then apply the given delivery state and settled value to it.boolean
drain()
Initiate a drain of all remaining credit of thisReceiver
link.boolean
drain(int credits)
Initiate a drain of the given credit from this thisReceiver
link.int
getCredit()
Get the credit that is currently available or assigned to this link.DeliveryState
getDefaultDeliveryState()
Role
getRole()
protected ProtonReceiver
handleRemoteAttach(Attach attach)
protected ProtonReceiver
handleRemoteDetach(Detach detach)
protected ProtonReceiver
handleRemoteDisposition(Disposition disposition, ProtonIncomingDelivery delivery)
protected ProtonReceiver
handleRemoteDisposition(Disposition disposition, ProtonOutgoingDelivery delivery)
protected ProtonReceiver
handleRemoteFlow(Flow flow)
protected ProtonIncomingDelivery
handleRemoteTransfer(Transfer transfer, ProtonBuffer payload)
boolean
hasUnsettled()
boolean
isDraining()
Indicates if the link is draining.protected ProtonReceiver
self()
ProtonReceiver
setDefaultDeliveryState(DeliveryState state)
Configures a default DeliveryState to be used if a received delivery is settled/freed without any disposition state having been previously applied.Receiver
settle(java.util.function.Predicate<IncomingDelivery> filter)
For each unsettled outgoing delivery that is pending in theReceiver
apply the given predicate and if it matches then settle the delivery.java.util.Collection<IncomingDelivery>
unsettled()
Retrieves the list of unsettled deliveries for thisReceiver
link 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 thisReceiver
link.
-
-
Method Detail
-
setDefaultDeliveryState
public ProtonReceiver setDefaultDeliveryState(DeliveryState state)
Description copied from interface:Receiver
Configures a default DeliveryState to be used if a received delivery is settled/freed without any disposition state having been previously applied.- Specified by:
setDefaultDeliveryState
in interfaceReceiver
- Parameters:
state
- the default delivery state- Returns:
- this
Receiver
for chaining.
-
getDefaultDeliveryState
public DeliveryState getDefaultDeliveryState()
- Specified by:
getDefaultDeliveryState
in interfaceReceiver
- Returns:
- the default delivery state for this delivery
-
getRole
public Role getRole()
-
self
protected ProtonReceiver self()
- Specified by:
self
in classProtonLink<Receiver>
-
getCredit
public int getCredit()
Description copied from interface:Link
Get the credit that is currently available or assigned to this link.
-
addCredit
public ProtonReceiver addCredit(int credit)
Description copied from interface:Receiver
Adds the given amount of credit for theReceiver
.
-
drain
public boolean drain()
Description copied from interface:Receiver
Initiate a drain of all remaining credit of thisReceiver
link.
-
drain
public boolean drain(int credits)
Description copied from interface:Receiver
Initiate a drain of the given credit from this thisReceiver
link. 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:Link
Indicates if the link is draining. For aSender
link 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 aReceiver
this indicates that the Receiver has requested that the Sender consume its outstanding credit.- Specified by:
isDraining
in interfaceLink<Receiver>
- Returns:
- true if the
Link
is currently marked as draining.
-
disposition
public Receiver disposition(java.util.function.Predicate<IncomingDelivery> filter, DeliveryState disposition, boolean settle)
Description copied from interface:Receiver
For each unsettled outgoing delivery that is pending in theReceiver
apply the given predicate and if it matches then apply the given delivery state and settled value to it.- Specified by:
disposition
in interfaceReceiver
- Parameters:
filter
- The predicate to apply to each unsettled delivery to test for a match.disposition
- The newDeliveryState
to apply to any matching outgoing deliveries.settle
- Boolean indicating if the matching unsettled deliveries should be settled.- Returns:
- this
Receiver
for chaining
-
settle
public Receiver settle(java.util.function.Predicate<IncomingDelivery> filter)
Description copied from interface:Receiver
For each unsettled outgoing delivery that is pending in theReceiver
apply the given predicate and if it matches then settle the delivery.
-
unsettled
public java.util.Collection<IncomingDelivery> unsettled()
Description copied from interface:Receiver
Retrieves the list of unsettled deliveries for thisReceiver
link which have yet to be settled on this end of the link. When theIncomingDelivery
is settled by the receiver the value will be removed from the collection. TheCollection
returned 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:
hasUnsettled
in interfaceReceiver
- Returns:
- true if there are unsettled deliveries for this
Receiver
link.
-
deliveryReadHandler
public Receiver deliveryReadHandler(EventHandler<IncomingDelivery> handler)
Description copied from interface:Receiver
Handler for incoming deliveries that is called for each incomingTransfer
frame 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 thatIncomingDelivery
arrive or the remote aborts the transfer.- Specified by:
deliveryReadHandler
in interfaceReceiver
- Parameters:
handler
- The handler that will be invoked whenTransfer
frames arrive on this receiver link.- Returns:
- this receiver
-
deliveryAbortedHandler
public Receiver deliveryAbortedHandler(EventHandler<IncomingDelivery> handler)
Description copied from interface:Receiver
Handler 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 theReceiver
will call the registeredReceiver.deliveryAbortedHandler(EventHandler)
if one is set.- Specified by:
deliveryAbortedHandler
in interfaceReceiver
- Parameters:
handler
- The handler that will be invoked whenTransfer
frames arrive on this receiver link.- Returns:
- this receiver
-
deliveryStateUpdatedHandler
public Receiver deliveryStateUpdatedHandler(EventHandler<IncomingDelivery> handler)
Description copied from interface:Receiver
Handler for updates to the remote state of incoming deliveries that have previously been received.Remote state updates for an
IncomingDelivery
can happen when the remote settles a completeIncomingDelivery
or otherwise modifies the delivery outcome and the user needs to act on those changes such as a spontaneous update to theDeliveryState
.- Specified by:
deliveryStateUpdatedHandler
in interfaceReceiver
- Parameters:
handler
- The handler that will be invoked when a new remote state update for anIncomingDelivery
arrives on this link.- Returns:
- this receiver
-
creditStateUpdateHandler
public Receiver creditStateUpdateHandler(EventHandler<Receiver> handler)
Description copied from interface:Link
Handler for link credit updates that occur after a remoteFlow
arrives.- Specified by:
creditStateUpdateHandler
in interfaceLink<Receiver>
- Parameters:
handler
- An event handler that will be signaled when the link credit is updated by a remote flow.- Returns:
- the
Link
for chaining.
-
handleRemoteAttach
protected final ProtonReceiver handleRemoteAttach(Attach attach)
- Specified by:
handleRemoteAttach
in classProtonLink<Receiver>
-
handleRemoteDetach
protected final ProtonReceiver handleRemoteDetach(Detach detach)
- Specified by:
handleRemoteDetach
in classProtonLink<Receiver>
-
handleRemoteFlow
protected final ProtonReceiver handleRemoteFlow(Flow flow)
- Specified by:
handleRemoteFlow
in classProtonLink<Receiver>
-
handleRemoteDisposition
protected final ProtonReceiver handleRemoteDisposition(Disposition disposition, ProtonIncomingDelivery delivery)
- Specified by:
handleRemoteDisposition
in classProtonLink<Receiver>
-
handleRemoteDisposition
protected final ProtonReceiver handleRemoteDisposition(Disposition disposition, ProtonOutgoingDelivery delivery)
- Specified by:
handleRemoteDisposition
in classProtonLink<Receiver>
-
handleRemoteTransfer
protected final ProtonIncomingDelivery handleRemoteTransfer(Transfer transfer, ProtonBuffer payload)
- Specified by:
handleRemoteTransfer
in classProtonLink<Receiver>
-
decorateOutgoingFlow
protected ProtonReceiver decorateOutgoingFlow(Flow flow)
- Specified by:
decorateOutgoingFlow
in classProtonLink<Receiver>
-
-