Interface IMessage
interface IMessage
Extends com.amazon.apmf.IStandard
The core messaging object. Supports both 1-to-1 and 1-to-many delivery,
including a strongly-typed payload called an “attachment”. See
IMessageBuilder.
Methods
getTargetUri()
string? getTargetUri()
The URI used to identify the target resource for this message.
Outbound messages built via makeMessageBuilder(string targetUri)
always carry a target URI. Response messages built via
IMessage::makeResponseBuilder() may have nullptr here because
they are routed by reply context, not by an explicit URI.
Returns
string?
The return value is optional and might be absent.
The destination URI that this message targets, or
nullptr for response messages.
getAttachmentBytes()
The serialized attachment payload, if one exists. The attachment is delivered to the receiver as a raw byte view of the Omnikit Data Object supplied by the sender; deserialization is the receiver’s responsibility. The receiver materializes a typed payload by passing the byte view through thecom.amazon.apmf.IDataObjectByteView?getAttachmentBytes()
GetDoFromArray<T> template,
which performs compile-time-typed deserialization. The expected
type is determined by the creator of the message and is typically
stable per getTargetUri().
Example: deserialize a typed payload.
Returns
com.amazon.apmf.IDataObjectByteView?
The return value is optional and might be absent.
The serialized attachment associated with this message, or
nullptr if no attachment was set.
getSenderCredential()
The credential of the message sender, used to verify whether the sender has appropriate privileges. The credential is stamped by the system atcom.amazon.apmf.ICredential?getSenderCredential()
IMessagingModule::send() time. If the message was built
using the builder but never sent, this returns nullptr because no
sender context exists yet.
Returns
com.amazon.apmf.ICredential?
The return value is optional and might be absent.
The credential of the message sender, or nullptr if the
message has not been sent.
getMessageProperties()
The message properties associated with this message. The return is non-nullable: when the message builder did not callIMessageProperties*getMessageProperties()
IMessageBuilder::messageProperties(), the system supplies a
default IMessageProperties instance with no metadata, default
priority, and no conflict-resolution hint.
Returns
IMessageProperties*
The message properties object associated with this message;
never nullptr.
makeResponseBuilder()
Creates a response message (builder) that will be delivered to target marked in the message. Must callIMessageBuilder*makeResponseBuilder()
IMessagingModule::send()
to send the response.
Returns
IMessageBuilder*
An instance of IMessageBuilder preconfigured to respond
back to the caller.
Throws
com.amazon.apmf.InvalidOperationError— if the message does not support sending a response.

