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, sessionFields inherited from class org.apache.qpid.protonj2.engine.impl.ProtonEndpoint
engine -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreditStateUpdateHandler(EventHandler<Sender> handler) Handler for link credit updates that occur after a remoteFlowarrives.current()Gets the currentOutgoingDeliveryfor thisSenderif one is available.protected final ProtonSenderdecorateOutgoingFlow(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 theSenderapply the given predicate and if it matches then apply the given delivery state and settled value to it.drained()Called when theReceiverhas requested a drain of credit and the sender has sent all available messages.intGet the credit that is currently available or assigned to this link.getRole()protected final ProtonSenderhandleRemoteAttach(Attach attach) protected final ProtonSenderhandleRemoteDetach(Detach detach) protected final ProtonSenderhandleRemoteDisposition(Disposition disposition, ProtonIncomingDelivery delivery) protected final ProtonSenderhandleRemoteDisposition(Disposition disposition, ProtonOutgoingDelivery delivery) protected final ProtonSenderhandleRemoteFlow(Flow flow) protected final ProtonIncomingDeliveryhandleRemoteTransfer(Transfer transfer, ProtonBuffer payload) booleanbooleanIndicates if the link is draining.booleanChecks 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 ProtonSenderself()setDeliveryTagGenerator(DeliveryTagGenerator generator) Configures aDeliveryTagGeneratorthat will be used to create and set aDeliveryTagvalue on each newOutgoingDeliverythat is created and returned from theSender.next()method.settle(Predicate<OutgoingDelivery> filter) For each unsettled outgoing delivery that is pending in theSenderapply the given predicate and if it matches then settle the delivery.protected voidprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidRetrieves 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, 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
-
ProtonSender
- Parameters:
session- The Session that is linked to this sender instance.name- The name assigned to thisSenderlink.
-
-
Method Details
-
getRole
-
self
- Specified by:
selfin classProtonLink<Sender>
-
getCredit
public int getCredit()Description copied from interface:LinkGet the credit that is currently available or assigned to this link. -
isSendable
public boolean isSendable()Description copied from interface:SenderChecks if the sender has credit and the session window allows for any bytes to be written currently.- Specified by:
isSendablein 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: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<Sender>- Returns:
- true if the
Linkis currently marked as draining.
-
drained
Description copied from interface:SenderCalled when theReceiverhas requested a drain of credit and the sender has sent all available messages. -
disposition
Description copied from interface:SenderFor each unsettled outgoing delivery that is pending in theSenderapply the given predicate and if it matches then apply the given delivery state and settled value to it.- Specified by:
dispositionin interfaceSender- Parameters:
filter- The predicate to apply to each unsettled delivery to test for a match.state- The newDeliveryStateto apply to any matching outgoing deliveries.settle- Boolean indicating if the matching unsettled deliveries should be settled.- Returns:
- this
Senderinstance.
-
settle
Description copied from interface:SenderFor each unsettled outgoing delivery that is pending in theSenderapply the given predicate and if it matches then settle the delivery. -
current
Description copied from interface:SenderGets the currentOutgoingDeliveryfor thisSenderif 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 finalTransferis 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:SenderWhen 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 currentOutgoingDeliveryhas 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:SenderRetrieves the list of unsettled deliveries sent from thisSender. The deliveries in theCollectioncannot be written to but can have their settled state and disposition updated. Only when thisSendersettles on its end are theOutgoingDeliveryinstances removed from the unsettledCollection. 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 interfaceSender- Returns:
- true if there are unsettled deliveries for this
Senderlink.
-
setDeliveryTagGenerator
Description copied from interface:SenderConfigures aDeliveryTagGeneratorthat will be used to create and set aDeliveryTagvalue on each newOutgoingDeliverythat is created and returned from theSender.next()method.- Specified by:
setDeliveryTagGeneratorin interfaceSender- Parameters:
generator- TheDeliveryTagGeneratorto use to create automaticDeliveryTagvalues.- Returns:
- this
Senderinstance.
-
getDeliveryTagGenerator
- Specified by:
getDeliveryTagGeneratorin interfaceSender- Returns:
- the currently configured
DeliveryTagGeneratorfor thisSender.
-
handleRemoteAttach
- Specified by:
handleRemoteAttachin classProtonLink<Sender>
-
handleRemoteDetach
- Specified by:
handleRemoteDetachin classProtonLink<Sender>
-
handleRemoteDisposition
protected final ProtonSender handleRemoteDisposition(Disposition disposition, ProtonIncomingDelivery delivery) - Specified by:
handleRemoteDispositionin classProtonLink<Sender>
-
handleRemoteDisposition
protected final ProtonSender handleRemoteDisposition(Disposition disposition, ProtonOutgoingDelivery delivery) - Specified by:
handleRemoteDispositionin classProtonLink<Sender>
-
handleRemoteTransfer
protected final ProtonIncomingDelivery handleRemoteTransfer(Transfer transfer, ProtonBuffer payload) - Specified by:
handleRemoteTransferin classProtonLink<Sender>
-
handleRemoteFlow
- Specified by:
handleRemoteFlowin classProtonLink<Sender>
-
decorateOutgoingFlow
- Specified by:
decorateOutgoingFlowin classProtonLink<Sender>
-
creditStateUpdateHandler
Description copied from interface:LinkHandler for link credit updates that occur after a remoteFlowarrives.- Specified by:
creditStateUpdateHandlerin interfaceLink<Sender>- Parameters:
handler- An event handler that will be signaled when the link credit is updated by a remote flow.- Returns:
- the
Linkfor chaining.
-
deliveryStateUpdatedHandler
Description copied from interface:SenderHandler 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:
deliveryStateUpdatedHandlerin interfaceSender- Parameters:
handler- The handler that will be invoked when a new update delivery arrives on this link.- Returns:
- this
Senderinstance.
-
transitionedToLocallyOpened
protected void transitionedToLocallyOpened()- Overrides:
transitionedToLocallyOpenedin classProtonLink<Sender>
-
transitionedToLocallyDetached
protected void transitionedToLocallyDetached()- Overrides:
transitionedToLocallyDetachedin classProtonLink<Sender>
-
transitionedToLocallyClosed
protected void transitionedToLocallyClosed()- Overrides:
transitionedToLocallyClosedin classProtonLink<Sender>
-
transitionToRemotelyDetached
protected void transitionToRemotelyDetached()- Overrides:
transitionToRemotelyDetachedin classProtonLink<Sender>
-
transitionToRemotelyClosed
protected void transitionToRemotelyClosed()- Overrides:
transitionToRemotelyClosedin classProtonLink<Sender>
-
transitionToParentLocallyClosed
protected void transitionToParentLocallyClosed()- Overrides:
transitionToParentLocallyClosedin classProtonLink<Sender>
-
transitionToParentRemotelyClosed
protected void transitionToParentRemotelyClosed()- Overrides:
transitionToParentRemotelyClosedin classProtonLink<Sender>
-