Class ClientDelivery
- All Implemented Interfaces:
Delivery
-
Field Summary
Fields inherited from class org.apache.qpid.protonj2.client.impl.ClientDeliverable
delivery, receiver
-
Method Summary
Modifier and TypeMethodDescriptionDecodes theDelivery
payload and returns aMap
containing a copy of any associatedDeliveryAnnotations
that were transmitted with theMessage
payload of thisDelivery
.<E> Message
<E> message()
Create and return anInputStream
that reads the raw payload bytes of the givenDelivery
.receiver()
protected ClientDelivery
self()
Methods inherited from class org.apache.qpid.protonj2.client.impl.ClientDeliverable
accept, disposition, messageFormat, modified, reject, release, remoteSettled, remoteState, settle, settled, state
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.client.Delivery
accept, disposition, messageFormat, modified, reject, release, remoteSettled, remoteState, settle, settled, state
-
Method Details
-
self
- Specified by:
self
in classClientDeliverable<ClientDelivery,
ClientReceiver>
-
receiver
-
message
Description copied from interface:Delivery
Decode theDelivery
payload and return anMessage
object.If the incoming message carried any delivery annotations they can be accessed via the
Delivery.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 theDelivery.rawInputStream()
method of theDelivery
object. Calling theDelivery.rawInputStream()
method after calling this method throwsClientIllegalStateException
.Care should be taken if attempting to specify anything other than the wild card type for the body of the returned message as the wrong type specification can lead to an exception.
- Specified by:
message
in interfaceDelivery
- Type Parameters:
E
- The type of message body that should be contained in the returnedMessage
.- Returns:
- a
Message
instance that wraps the decoded payload. - Throws:
ClientException
- if an error occurs while decoding the payload.
-
rawInputStream
Description copied from interface:Delivery
Create and return anInputStream
that reads the raw payload bytes of the givenDelivery
.Calling this method claims the payload of the delivery for the returned
InputStream
and excludes use of theDelivery.message()
andDelivery.annotations()
methods of theDelivery
object. Closing the returned input stream discards any unread bytes from the delivery payload. Calling theDelivery.message()
orDelivery.annotations()
methods after calling this method throwsClientIllegalStateException
.- Specified by:
rawInputStream
in interfaceDelivery
- Returns:
- an
InputStream
instance that can be used to read the raw delivery payload. - Throws:
ClientException
- if an error occurs while decoding the payload.
-
annotations
Description copied from interface:Delivery
Decodes theDelivery
payload and returns aMap
containing a copy of any associatedDeliveryAnnotations
that were transmitted with theMessage
payload of thisDelivery
.Calling this message claims the payload of the delivery for the returned
Map
and the decodedMessage
that can be accessed via theDelivery.message()
method and excludes use of theDelivery.rawInputStream()
method of theDelivery
object. Calling theDelivery.rawInputStream()
method after calling this method throwsClientIllegalStateException
.- Specified by:
annotations
in interfaceDelivery
- Returns:
- copy of the delivery annotations that were transmitted with the
Message
payload. - Throws:
ClientException
- if an error occurs while decoding the payload.
-