Class ProtonOutgoingDelivery
- java.lang.Object
- 
- org.apache.qpid.protonj2.engine.impl.ProtonOutgoingDelivery
 
- 
- All Implemented Interfaces:
- OutgoingDelivery
 
 public class ProtonOutgoingDelivery extends java.lang.Object implements OutgoingDelivery Proton outgoing delivery implementation
- 
- 
Constructor SummaryConstructors Constructor Description ProtonOutgoingDelivery(ProtonSender link)Creates an empty outgoing delivery instance that is owned by the givenProtonSenderinstance.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description OutgoingDeliveryabort()Aborts the outgoing delivery if not already settled.ProtonOutgoingDeliverydeliveryStateUpdatedHandler(EventHandler<OutgoingDelivery> handler)Handler for updates to the remote state of outgoing deliveries that have begun transferring frames.OutgoingDeliverydisposition(DeliveryState state)updates the state of the deliveryOutgoingDeliverydisposition(DeliveryState state, boolean settle)Update the delivery with the given disposition if not locally settled and optionally settles the delivery if not already settled.ProtonAttachmentsgetAttachments()ProtonSendergetLink()<T> TgetLinkedResource()<T> TgetLinkedResource(java.lang.Class<T> typeClass)Gets the linked resource (if set) and returns it using the type information provided to cast the returned value.intgetMessageFormat()Gets the message-format for this Delivery, representing the 32bit value using an int.DeliveryStategetRemoteState()DeliveryStategetState()DeliveryTaggetTag()intgetTransferCount()Returns the total number of transfer frames that have occurred for the givenOutgoingDelivery.booleanisAborted()booleanisPartial()Check for whether the delivery is still partial.booleanisRemotelySettled()booleanisSettled()ProtonOutgoingDeliverysetLinkedResource(java.lang.Object resource)Links a given resource to thisEndpoint.OutgoingDeliverysetMessageFormat(int messageFormat)Sets the message-format for this Delivery, representing the 32bit value using an integer value.OutgoingDeliverysetTag(byte[] deliveryTag)Sets the delivery tag to assign to this outgoing delivery from the given byte array.OutgoingDeliverysetTag(DeliveryTag deliveryTag)Sets theDeliveryTagto assign to this outgoing delivery.OutgoingDeliverysettle()Settles this delivery if not already settled.OutgoingDeliverystreamBytes(ProtonBuffer buffer)Write the given bytes as a portion of the payload of this delivery, additional bytes can be streamed until the stream complete flag is set to true on a call toOutgoingDelivery.streamBytes(ProtonBuffer, boolean)or a call toOutgoingDelivery.writeBytes(ProtonBuffer)is made.OutgoingDeliverystreamBytes(ProtonBuffer buffer, boolean complete)Write the given bytes as a portion of the payload of this delivery, additional bytes can be streamed until the stream complete flag is set to true on a call toOutgoingDelivery.streamBytes(ProtonBuffer, boolean)and the buffer contents on that send are fully written.java.lang.StringtoString()OutgoingDeliverywriteBytes(ProtonBuffer buffer)Write the given bytes as the payload of this delivery, no additional writes can occur on this delivery if the write succeeds in sending all of the given bytes.
 
- 
- 
- 
Constructor Detail- 
ProtonOutgoingDeliverypublic ProtonOutgoingDelivery(ProtonSender link) Creates an empty outgoing delivery instance that is owned by the givenProtonSenderinstance.- Parameters:
- link- the- Senderlink that owns this outgoing delivery.
 
 
- 
 - 
Method Detail- 
getLinkpublic ProtonSender getLink() - Specified by:
- getLinkin interface- OutgoingDelivery
- Returns:
- the link that this OutgoingDeliveryis bound to.
 
 - 
getAttachmentspublic ProtonAttachments getAttachments() - Specified by:
- getAttachmentsin interface- OutgoingDelivery
- Returns:
- the Attachmentsinstance that is associated with thisOutgoingDelivery
 
 - 
setLinkedResourcepublic ProtonOutgoingDelivery setLinkedResource(java.lang.Object resource) Description copied from interface:OutgoingDeliveryLinks a given resource to thisEndpoint.- Specified by:
- setLinkedResourcein interface- OutgoingDelivery
- Parameters:
- resource- The resource to link to this- Endpoint.
- Returns:
- this OutgoingDeliveryinstance.
 
 - 
getLinkedResourcepublic <T> T getLinkedResource() - Specified by:
- getLinkedResourcein interface- OutgoingDelivery
- Type Parameters:
- T- The type that the linked resource should be cast to on return.
- Returns:
- the user set linked resource for this Endpointinstance.
 
 - 
getLinkedResourcepublic <T> T getLinkedResource(java.lang.Class<T> typeClass) Description copied from interface:OutgoingDeliveryGets the linked resource (if set) and returns it using the type information provided to cast the returned value.- Specified by:
- getLinkedResourcein interface- OutgoingDelivery
- Type Parameters:
- T- The type to cast the linked resource to if one is set.
- Parameters:
- typeClass- the type's Class which is used for casting the returned value.
- Returns:
- the user set linked resource for this Context instance.
 
 - 
getTagpublic DeliveryTag getTag() - Specified by:
- getTagin interface- OutgoingDelivery
- Returns:
- the DeliveryTagassigned to this Delivery.
 
 - 
setTagpublic OutgoingDelivery setTag(byte[] deliveryTag) Description copied from interface:OutgoingDeliverySets the delivery tag to assign to this outgoing delivery from the given byte array.- Specified by:
- setTagin interface- OutgoingDelivery
- Parameters:
- deliveryTag- a byte array containing the delivery tag to assign to this- OutgoingDelivery
- Returns:
- this OutgoingDeliveryinstance.
 
 - 
setTagpublic OutgoingDelivery setTag(DeliveryTag deliveryTag) Description copied from interface:OutgoingDeliverySets theDeliveryTagto assign to this outgoing delivery.- Specified by:
- setTagin interface- OutgoingDelivery
- Parameters:
- deliveryTag- a byte array containing the delivery tag to assign to this- OutgoingDelivery
- Returns:
- this OutgoingDeliveryinstance.
 
 - 
getStatepublic DeliveryState getState() - Specified by:
- getStatein interface- OutgoingDelivery
- Returns:
- the DeliveryStateat the local side of this Delivery.
 
 - 
getRemoteStatepublic DeliveryState getRemoteState() - Specified by:
- getRemoteStatein interface- OutgoingDelivery
- Returns:
- the DeliveryStateat the remote side of this Delivery.
 
 - 
getMessageFormatpublic int getMessageFormat() Description copied from interface:OutgoingDeliveryGets the message-format for this Delivery, representing the 32bit value using an int.The default value is 0 as per the message format defined in the core AMQP 1.0 specification. See the following for more details: 
 http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-transport-v1.0-os.html#type-transfer
 http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-transport-v1.0-os.html#type-message-format
 http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#section-message-format
 http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#definition-MESSAGE-FORMAT- Specified by:
- getMessageFormatin interface- OutgoingDelivery
- Returns:
- the message-format for this Delivery.
 
 - 
setMessageFormatpublic OutgoingDelivery setMessageFormat(int messageFormat) Description copied from interface:OutgoingDeliverySets the message-format for this Delivery, representing the 32bit value using an integer value. The message format can only be set@Override prior to the firstTransferof delivery payload having been written. If one of the delivery write methods is called prior to the message format being set then it defaults to the AMQP default format of zero.The default value is 0 as per the message format defined in the core AMQP 1.0 specification. See the following for more details: 
 http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-transport-v1.0-os.html#type-transfer
 http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-transport-v1.0-os.html#type-message-format
 http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#section-message-format
 http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#definition-MESSAGE-FORMAT- Specified by:
- setMessageFormatin interface- OutgoingDelivery
- Parameters:
- messageFormat- the message format
- Returns:
- this OutgoingDeliveryinstance.
 
 - 
isPartialpublic boolean isPartial() Description copied from interface:OutgoingDeliveryCheck for whether the delivery is still partial.For a receiving Delivery, this means the delivery does not hold a complete message payload as all the content hasn't been received yet. Note that an aborteddelivery will also be considered partial and the full payload won't be received.For a sending Delivery, this means that the application has not marked the delivery as complete yet. - Specified by:
- isPartialin interface- OutgoingDelivery
- Returns:
- true if the delivery is partial
- See Also:
- OutgoingDelivery.isAborted()
 
 - 
isAbortedpublic boolean isAborted() - Specified by:
- isAbortedin interface- OutgoingDelivery
- Returns:
- true if the delivery has been aborted.
 
 - 
isSettledpublic boolean isSettled() - Specified by:
- isSettledin interface- OutgoingDelivery
- Returns:
- true if the delivery has been settled locally.
 
 - 
isRemotelySettledpublic boolean isRemotelySettled() - Specified by:
- isRemotelySettledin interface- OutgoingDelivery
- Returns:
- true if the delivery has been settled by the remote.
 
 - 
dispositionpublic OutgoingDelivery disposition(DeliveryState state) Description copied from interface:OutgoingDeliveryupdates the state of the delivery- Specified by:
- dispositionin interface- OutgoingDelivery
- Parameters:
- state- the new delivery state
- Returns:
- this OutgoingDeliveryinstance.
 
 - 
dispositionpublic OutgoingDelivery disposition(DeliveryState state, boolean settle) Description copied from interface:OutgoingDeliveryUpdate the delivery with the given disposition if not locally settled and optionally settles the delivery if not already settled.The action taken by this method depends on the state of the OutgoingDeliveryat the time it is called.If there has yet to be any writes from this delivery the delivery state and settlement value is cached and applied to the first (or only) write of payload from this delivery. If however a write has already been performed than this method result in a Dispositionframe being sent to the remote with the given delivery state and settlement value. Once the delivery is marked as settled any future call to this method will do nothing if the requested disposition and settlement is the same however if a new state is applied which cannot be conveyed due to having already locally settling theOutgoingDeliverythan anIllegalStateExceptionis thrown to indicate that request is not valid.- Specified by:
- dispositionin interface- OutgoingDelivery
- Parameters:
- state- the new delivery state
- settle- if true the delivery is settled.
- Returns:
- this OutgoingDeliveryinstance.
 
 - 
settlepublic OutgoingDelivery settle() Description copied from interface:OutgoingDeliverySettles this delivery if not already settled. Once settled locally no further updates to the delivery state can be applied. If called prior to the first write of payload bytes the settlement state is cached and transmitted within the firstTransferframe of thisOutgoingDelivery.- Specified by:
- settlein interface- OutgoingDelivery
- Returns:
- this OutgoingDeliveryinstance.
 
 - 
writeBytespublic OutgoingDelivery writeBytes(ProtonBuffer buffer) Description copied from interface:OutgoingDeliveryWrite the given bytes as the payload of this delivery, no additional writes can occur on this delivery if the write succeeds in sending all of the given bytes.When called the provided buffer is treated as containing the entirety of the transfer payload and the Transfer(s) that result from this call will result in a final Transfer frame whose more flag is set to false which tells the remote that no additional data will be sent for this Transfer. TheSenderwill output as much of the buffer as possible within the constraints of both the link credit and the current capacity of the parentSession.The caller must check that all bytes were written and if not they should await updates from the Link.creditStateUpdateHandler(EventHandler)that indicate that theSender.isSendable()has become true again or the caller should checkSender.isSendable()periodically until it becomes true once again.- Specified by:
- writeBytesin interface- OutgoingDelivery
- Parameters:
- buffer- The buffer whose contents should be sent.
- Returns:
- this OutgoingDeliveryinstance.
 
 - 
streamBytespublic OutgoingDelivery streamBytes(ProtonBuffer buffer) Description copied from interface:OutgoingDeliveryWrite the given bytes as a portion of the payload of this delivery, additional bytes can be streamed until the stream complete flag is set to true on a call toOutgoingDelivery.streamBytes(ProtonBuffer, boolean)or a call toOutgoingDelivery.writeBytes(ProtonBuffer)is made.The Senderwill output as much of the buffer as possible within the constraints of both the link credit and the current capacity of the parentSession. The caller must check that all bytes were0 written and if not they should await updates from theLink.creditStateUpdateHandler(EventHandler)that indicate that theSender.isSendable()has become true again or the caller should checkSender.isSendable()periodically until it becomes true once again.This method is the same as calling OutgoingDelivery.streamBytes(ProtonBuffer, boolean)with the complete value set to false.- Specified by:
- streamBytesin interface- OutgoingDelivery
- Parameters:
- buffer- The buffer whose contents should be sent.
- Returns:
- this OutgoingDeliveryinstance.
 
 - 
streamBytespublic OutgoingDelivery streamBytes(ProtonBuffer buffer, boolean complete) Description copied from interface:OutgoingDeliveryWrite the given bytes as a portion of the payload of this delivery, additional bytes can be streamed until the stream complete flag is set to true on a call toOutgoingDelivery.streamBytes(ProtonBuffer, boolean)and the buffer contents on that send are fully written.The Senderwill output as much of the buffer as possible within the constraints of both the link credit and the current capacity of the parentSession. The caller must check that all bytes were0 written and if not they should await updates from theLink.creditStateUpdateHandler(EventHandler)that indicate that theSender.isSendable()has become true again or the caller should checkSender.isSendable()periodically until it becomes true once again.- Specified by:
- streamBytesin interface- OutgoingDelivery
- Parameters:
- buffer- The buffer whose contents should be sent.
- complete- When true the delivery is marked complete and no further bytes can be written.
- Returns:
- this OutgoingDeliveryinstance.
 
 - 
abortpublic OutgoingDelivery abort() Description copied from interface:OutgoingDeliveryAborts the outgoing delivery if not already settled.- Specified by:
- abortin interface- OutgoingDelivery
- Returns:
- this delivery.
 
 - 
deliveryStateUpdatedHandlerpublic ProtonOutgoingDelivery deliveryStateUpdatedHandler(EventHandler<OutgoingDelivery> handler) Description copied from interface:OutgoingDeliveryHandler for updates to the remote state of outgoing deliveries that have begun transferring frames.Remote state updates for an OutgoingDeliverycan happen when the remote settles a completeOutgoingDeliveryor otherwise modifies the delivery outcome and the user needs to act on those changes such as a spontaneous update to theDeliveryState. If the initialTransferof an outgoing delivery already indicates settlement then this handler will never be called.- Specified by:
- deliveryStateUpdatedHandlerin interface- OutgoingDelivery
- Parameters:
- handler- The handler that will be invoked when a new remote state update for an- OutgoingDeliveryarrives on this link.
- Returns:
- this OutgoingDeliveryinstance.
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
getTransferCountpublic int getTransferCount() Description copied from interface:OutgoingDeliveryReturns the total number of transfer frames that have occurred for the givenOutgoingDelivery. If theOutgoingDeliveryhas yet to have any of its write methods called this value will read zero. Aborting a transfer after anyTransferframes have been written will not result in an addition recordedTransferwrite.- Specified by:
- getTransferCountin interface- OutgoingDelivery
- Returns:
- the number of Transferframes that thisOutgoingDeliveryhas initiated.
 
 
- 
 
-