Interface StreamDelivery
-
- All Known Implementing Classes:
ClientStreamDelivery
public interface StreamDelivery
A specializedStreamDelivery
type that is returned from theStreamReceiver
which can be used to read incoming large messages that are streamed via multiple incoming AMQPTransfer
frames.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
aborted()
Check if theStreamDelivery
has been marked as aborted by the remote sender.StreamDelivery
accept()
Accepts and settles the delivery.java.util.Map<java.lang.String,java.lang.Object>
annotations()
Decodes theStreamDelivery
payload and returns aMap
containing a copy of any associatedDeliveryAnnotations
that were transmitted with theMessage
payload of thisStreamDelivery
.boolean
completed()
Check if theStreamDelivery
has been marked as complete by the remote sender.StreamDelivery
disposition(DeliveryState state, boolean settle)
Updates the DeliveryState, and optionally settle the delivery as well.StreamReceiverMessage
message()
Decode theStreamDelivery
payload and return anMessage
object.int
messageFormat()
Gets the message format for the current delivery.StreamDelivery
modified(boolean deliveryFailed, boolean undeliverableHere)
Modifies and settles the delivery.java.io.InputStream
rawInputStream()
Create and return anInputStream
that reads the raw payload bytes of the givenStreamDelivery
.StreamReceiver
receiver()
StreamDelivery
reject(java.lang.String condition, java.lang.String description)
Rejects and settles the delivery, sending supplied error information along with the rejection.StreamDelivery
release()
Releases and settles the delivery.boolean
remoteSettled()
Gets whether the delivery was settled by the remote peer yet.DeliveryState
remoteState()
Gets the current remote state for the delivery.StreamDelivery
settle()
Settles the delivery locally.boolean
settled()
DeliveryState
state()
Gets the current local state for the delivery.
-
-
-
Method Detail
-
receiver
StreamReceiver receiver()
- Returns:
- the
StreamReceiver
that originated thisStreamDelivery
.
-
message
StreamReceiverMessage message() throws ClientException
Decode theStreamDelivery
payload and return anMessage
object.If the incoming message carried any delivery annotations they can be accessed via the
annotations()
method. Re-sending the returned message will not also send the incoming delivery annotations, the sender must include them in theSender.send(Message, Map)
call if they are to be forwarded onto the next recipient.Calling this message claims the payload of the delivery for the returned
Message
and excludes use of therawInputStream()
method of theStreamDelivery
object. Calling therawInputStream()
method after calling this method throwsClientIllegalStateException
.- Returns:
- a
Message
instance that wraps the decoded payload. - Throws:
ClientException
- if an error occurs while decoding the payload.
-
rawInputStream
java.io.InputStream rawInputStream() throws ClientException
Create and return anInputStream
that reads the raw payload bytes of the givenStreamDelivery
.Calling this method claims the payload of the delivery for the returned
InputStream
and excludes use of themessage()
andannotations()
methods of theStreamDelivery
object. Closing the returned input stream discards any unread bytes from the delivery payload. Calling themessage()
orannotations()
methods after calling this method throwsClientIllegalStateException
.- Returns:
- an
InputStream
instance that can be used to read the raw delivery payload. - Throws:
ClientException
- if an error occurs while decoding the payload.
-
aborted
boolean aborted()
Check if theStreamDelivery
has been marked as aborted by the remote sender.- Returns:
- true if this context has been marked as aborted previously.
-
completed
boolean completed()
Check if theStreamDelivery
has been marked as complete by the remote sender.- Returns:
- true if this context has been marked as being the complete.
-
annotations
java.util.Map<java.lang.String,java.lang.Object> annotations() throws ClientException
Decodes theStreamDelivery
payload and returns aMap
containing a copy of any associatedDeliveryAnnotations
that were transmitted with theMessage
payload of thisStreamDelivery
.Calling this message claims the payload of the delivery for the returned
Map
and the decodedMessage
that can be accessed via themessage()
method and excludes use of therawInputStream()
method of theStreamDelivery
object. Calling therawInputStream()
method after calling this method throwsClientIllegalStateException
.- Returns:
- copy of the delivery annotations that were transmitted with the
Message
payload. - Throws:
ClientException
- if an error occurs while decoding the payload.
-
accept
StreamDelivery accept() throws ClientException
Accepts and settles the delivery.- Returns:
- this
StreamDelivery
instance. - Throws:
ClientException
- if an error occurs while sending the disposition
-
release
StreamDelivery release() throws ClientException
Releases and settles the delivery.- Returns:
- this
StreamDelivery
instance. - Throws:
ClientException
- if an error occurs while sending the disposition
-
reject
StreamDelivery reject(java.lang.String condition, java.lang.String description) throws ClientException
Rejects and settles the delivery, sending supplied error information along with the rejection.- Parameters:
condition
- The error condition value to supply with the rejection.description
- The error description value to supply with the rejection.- Returns:
- this
StreamDelivery
instance. - Throws:
ClientException
- if an error occurs while sending the disposition
-
modified
StreamDelivery modified(boolean deliveryFailed, boolean undeliverableHere) throws ClientException
Modifies and settles the delivery.- Parameters:
deliveryFailed
- Indicates if the modified delivery failed.undeliverableHere
- Indicates if the modified delivery should not be returned here again.- Returns:
- this
StreamDelivery
instance. - Throws:
ClientException
- if an error occurs while sending the disposition
-
disposition
StreamDelivery disposition(DeliveryState state, boolean settle) throws ClientException
Updates the DeliveryState, and optionally settle the delivery as well.- Parameters:
state
- the delivery state to applysettle
- whether tosettle()
the delivery at the same time- Returns:
- this
StreamDelivery
instance. - Throws:
ClientException
- if an error occurs while sending the disposition
-
settle
StreamDelivery settle() throws ClientException
Settles the delivery locally.- Returns:
- the delivery
- Throws:
ClientException
- if an error occurs while sending the disposition
-
settled
boolean settled() throws ClientException
- Returns:
- true if the delivery has been locally settled.
- Throws:
ClientException
- if an error occurs while reading the settled state
-
state
DeliveryState state() throws ClientException
Gets the current local state for the delivery.- Returns:
- the delivery state
- Throws:
ClientException
- if an error occurs while reading the delivery state
-
remoteState
DeliveryState remoteState() throws ClientException
Gets the current remote state for the delivery.- Returns:
- the remote delivery state
- Throws:
ClientException
- if an error occurs while reading the remote delivery state
-
remoteSettled
boolean remoteSettled() throws ClientException
Gets whether the delivery was settled by the remote peer yet.- Returns:
- whether the delivery is remotely settled
- Throws:
ClientException
- if an error occurs while reading the remote settlement state
-
messageFormat
int messageFormat() throws ClientException
Gets the message format for the current delivery.- Returns:
- the message format
- Throws:
ClientException
- if an error occurs while reading the delivery message format
-
-