Class ProtonSender
java.lang.Object
org.apache.qpid.protonj2.engine.impl.ProtonEndpoint<L>
org.apache.qpid.protonj2.engine.impl.ProtonLink<Sender>
org.apache.qpid.protonj2.engine.impl.ProtonSender
Proton Sender link implementation.
-
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
-
Method Summary
Modifier and TypeMethodDescriptioncreditStateUpdateHandler
(EventHandler<Sender> handler) Handler for link credit updates that occur after a remoteFlow
arrives.current()
Gets the currentOutgoingDelivery
for thisSender
if one is available.protected final ProtonSender
decorateOutgoingFlow
(Flow flow) Handler for updates for deliveries that have previously been sent.disposition
(Predicate<OutgoingDelivery> filter, DeliveryState state, boolean settle) For each unsettled outgoing delivery that is pending in theSender
apply the given predicate and if it matches then apply the given delivery state and settled value to it.drained()
Called when theReceiver
has requested a drain of credit and the sender has sent all available messages.int
Get the credit that is currently available or assigned to this link.getRole()
protected final ProtonSender
handleRemoteAttach
(Attach attach) protected final ProtonSender
handleRemoteDetach
(Detach detach) protected final ProtonSender
handleRemoteDisposition
(Disposition disposition, ProtonIncomingDelivery delivery) protected final ProtonSender
handleRemoteDisposition
(Disposition disposition, ProtonOutgoingDelivery delivery) protected final ProtonSender
handleRemoteFlow
(Flow flow) protected final ProtonIncomingDelivery
handleRemoteTransfer
(Transfer transfer, ProtonBuffer payload) boolean
boolean
Indicates if the link is draining.boolean
Checks if the sender has credit and the session window allows for any bytes to be written currently.next()
When there has been no deliveries so far or the current delivery has reached a complete state this method updates the current delivery to a new instance and returns that value.protected ProtonSender
self()
setDeliveryTagGenerator
(DeliveryTagGenerator generator) Configures aDeliveryTagGenerator
that will be used to create and set aDeliveryTag
value on each newOutgoingDelivery
that is created and returned from theSender.next()
method.settle
(Predicate<OutgoingDelivery> filter) For each unsettled outgoing delivery that is pending in theSender
apply the given predicate and if it matches then settle the delivery.protected void
protected void
protected void
protected void
protected void
protected void
protected void
Retrieves the list of unsettled deliveries sent from thisSender
.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, 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 Details
-
ProtonSender
- Parameters:
session
- The Session that is linked to this sender instance.name
- The name assigned to thisSender
link.
-
-
Method Details
-
getRole
-
self
- Specified by:
self
in classProtonLink<Sender>
-
getCredit
public int getCredit()Description copied from interface:Link
Get the credit that is currently available or assigned to this link. -
isSendable
public boolean isSendable()Description copied from interface:Sender
Checks if the sender has credit and the session window allows for any bytes to be written currently.- Specified by:
isSendable
in interfaceSender
- Returns:
- true if the link has credit and the session window allows for any bytes to be written.
-
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<Sender>
- Returns:
- true if the
Link
is currently marked as draining.
-
drained
Description copied from interface:Sender
Called when theReceiver
has requested a drain of credit and the sender has sent all available messages. -
disposition
Description copied from interface:Sender
For each unsettled outgoing delivery that is pending in theSender
apply the given predicate and if it matches then apply the given delivery state and settled value to it.- Specified by:
disposition
in interfaceSender
- Parameters:
filter
- The predicate to apply to each unsettled delivery to test for a match.state
- The newDeliveryState
to apply to any matching outgoing deliveries.settle
- Boolean indicating if the matching unsettled deliveries should be settled.- Returns:
- this
Sender
instance.
-
settle
Description copied from interface:Sender
For each unsettled outgoing delivery that is pending in theSender
apply the given predicate and if it matches then settle the delivery. -
current
Description copied from interface:Sender
Gets the currentOutgoingDelivery
for thisSender
if one is available.The sender only tracks a current delivery in the case that the next method has bee called and if any bytes are written to the delivery using the streaming based API
OutgoingDelivery.streamBytes(ProtonBuffer)
which allows for later writing of additional bytes to the delivery. Once the methodOutgoingDelivery.writeBytes(ProtonBuffer)
is called the finalTransfer
is written indicating that the delivery is complete and the current delivery value is reset. An outgoing delivery that is being streamed may also be completed by calling theOutgoingDelivery.abort()
method. -
next
Description copied from interface:Sender
When there has been no deliveries so far or the current delivery has reached a complete state this method updates the current delivery to a new instance and returns that value. If the currentOutgoingDelivery
has not been completed by either calling theOutgoingDelivery.writeBytes(ProtonBuffer)
or theOutgoingDelivery.abort()
method then this method will throw an exception to indicate the sender state cannot allow a new delivery to be started. -
unsettled
Description copied from interface:Sender
Retrieves the list of unsettled deliveries sent from thisSender
. The deliveries in theCollection
cannot be written to but can have their settled state and disposition updated. Only when thisSender
settles on its end are theOutgoingDelivery
instances removed from the unsettledCollection
. 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 interfaceSender
- Returns:
- true if there are unsettled deliveries for this
Sender
link.
-
setDeliveryTagGenerator
Description copied from interface:Sender
Configures aDeliveryTagGenerator
that will be used to create and set aDeliveryTag
value on each newOutgoingDelivery
that is created and returned from theSender.next()
method.- Specified by:
setDeliveryTagGenerator
in interfaceSender
- Parameters:
generator
- TheDeliveryTagGenerator
to use to create automaticDeliveryTag
values.- Returns:
- this
Sender
instance.
-
getDeliveryTagGenerator
- Specified by:
getDeliveryTagGenerator
in interfaceSender
- Returns:
- the currently configured
DeliveryTagGenerator
for thisSender
.
-
handleRemoteAttach
- Specified by:
handleRemoteAttach
in classProtonLink<Sender>
-
handleRemoteDetach
- Specified by:
handleRemoteDetach
in classProtonLink<Sender>
-
handleRemoteDisposition
protected final ProtonSender handleRemoteDisposition(Disposition disposition, ProtonIncomingDelivery delivery) - Specified by:
handleRemoteDisposition
in classProtonLink<Sender>
-
handleRemoteDisposition
protected final ProtonSender handleRemoteDisposition(Disposition disposition, ProtonOutgoingDelivery delivery) - Specified by:
handleRemoteDisposition
in classProtonLink<Sender>
-
handleRemoteTransfer
protected final ProtonIncomingDelivery handleRemoteTransfer(Transfer transfer, ProtonBuffer payload) - Specified by:
handleRemoteTransfer
in classProtonLink<Sender>
-
handleRemoteFlow
- Specified by:
handleRemoteFlow
in classProtonLink<Sender>
-
decorateOutgoingFlow
- Specified by:
decorateOutgoingFlow
in classProtonLink<Sender>
-
creditStateUpdateHandler
Description copied from interface:Link
Handler for link credit updates that occur after a remoteFlow
arrives.- Specified by:
creditStateUpdateHandler
in interfaceLink<Sender>
- Parameters:
handler
- An event handler that will be signaled when the link credit is updated by a remote flow.- Returns:
- the
Link
for chaining.
-
deliveryStateUpdatedHandler
Description copied from interface:Sender
Handler for updates for deliveries that have previously been sent. Updates can happen when the remote settles or otherwise modifies the delivery and the user needs to act on those changes.- Specified by:
deliveryStateUpdatedHandler
in interfaceSender
- Parameters:
handler
- The handler that will be invoked when a new update delivery arrives on this link.- Returns:
- this
Sender
instance.
-
transitionedToLocallyOpened
protected void transitionedToLocallyOpened()- Overrides:
transitionedToLocallyOpened
in classProtonLink<Sender>
-
transitionedToLocallyDetached
protected void transitionedToLocallyDetached()- Overrides:
transitionedToLocallyDetached
in classProtonLink<Sender>
-
transitionedToLocallyClosed
protected void transitionedToLocallyClosed()- Overrides:
transitionedToLocallyClosed
in classProtonLink<Sender>
-
transitionToRemotelyDetached
protected void transitionToRemotelyDetached()- Overrides:
transitionToRemotelyDetached
in classProtonLink<Sender>
-
transitionToRemotelyClosed
protected void transitionToRemotelyClosed()- Overrides:
transitionToRemotelyClosed
in classProtonLink<Sender>
-
transitionToParentLocallyClosed
protected void transitionToParentLocallyClosed()- Overrides:
transitionToParentLocallyClosed
in classProtonLink<Sender>
-
transitionToParentRemotelyClosed
protected void transitionToParentRemotelyClosed()- Overrides:
transitionToParentRemotelyClosed
in classProtonLink<Sender>
-