Apama
10.5.4.1
|
A container for an payload and associated metadata. More...
#include <sag_connectivity_cpp.hpp>
Inherits sag_underlying_message_t.
Public Types | |
typedef com::softwareag::connectivity::metadata_t | metadata_t |
The type of a message metadata. More... | |
typedef data_t | payload_t |
The type of a message payload. More... | |
Public Member Functions | |
Message () | |
Construct an empty message. More... | |
Message (payload_t &&_payload) | |
Construct a message from a payload. More... | |
Message (payload_t &&_payload, metadata_t &&_metadata) | |
Construct a message from a payload and metadata. More... | |
Message (payload_t &&_payload, map_t &&_metadata) | |
Construct a message from a payload and map_t. More... | |
~Message () | |
Free the underlying payload and metadata. More... | |
Message (Message &&other) | |
Move constructor from another message. More... | |
Message & | operator= (Message &&other) |
Move assignment from another message. More... | |
const payload_t & | getPayload () const |
Return a reference to the payload. More... | |
const metadata_t & | getMetadata () const |
payload_t & | getPayload () |
Return a reference to the payload. More... | |
metadata_t & | getMetadata () |
map_t & | getMetadataMap () |
Return a view on the metadata which can contain non-string values. More... | |
const map_t & | getMetadataMap () const |
Return a view on the metadata which can contain non-string values. More... | |
void | setPayload (payload_t &&_payload) |
Set the payload. More... | |
void | setMetadata (metadata_t &&_metadata) |
Set the metadata as metadata_t. More... | |
void | setMetadata (map_t &&_metadata) |
Set the metadata as map_t. More... | |
void | swap (Message &&other) |
Swap the contents of this message with another. More... | |
Message | copy () const |
Return a deep copy of this message, payload and metadata. More... | |
Message & | putMetadataValue (data_t &&key, data_t &&value) |
Sets a value in the metadata. More... | |
Static Public Member Functions | |
static const char * | HOST_MESSAGE_TYPE () |
Returns the metadata key used by the host for identifying the type of the message - "sag.type". More... | |
static const char * | CHANNEL () |
Returns the metadata key used by the host for identifying the channel of the message - "sag.channel". More... | |
static const char * | CONTROL_TYPE () |
The metadata key indicating that a message is a control message, and what its type is. More... | |
static const char * | MESSAGE_ID () |
The metadata key used for unique identification of towards-host messages. More... | |
static const char * | REQUEST_ID () |
The metadata key used for unique identification of towards-transport control messages, with a value of type int64_t. More... | |
static const char * | CONTROL_TYPE_FLUSH () |
Name of the Flush control message, a towards-transport control message. More... | |
static const char * | CONTROL_TYPE_FLUSH_ACK () |
Name of the FlushAck control message, a towards-host control message in response to Flush, containing the corresponding REQUEST_ID. More... | |
static const char * | CONTROL_TYPE_ACK_REQUIRED () |
Name of the AckRequired control message, a towards-host control message. More... | |
static const char * | CONTROL_TYPE_ACK_UPTO () |
Name of the AckUpTo control message, a towards-transport control message in response to AckRequired, containing the corresponding MESSAGE_ID. More... | |
A container for an payload and associated metadata.
This class is not thread-safe, so users are required to ensure that each instance of Message is only accessed by the codec or transport plug-in that currently owns it, and that only one thread is accessing it at any one time.
typedef com::softwareag::connectivity::metadata_t com::softwareag::connectivity::Message::metadata_t |
The type of a message metadata.
The type of a message payload.
com::softwareag::connectivity::Message::Message | ( | ) |
Construct an empty message.
|
explicit |
Construct a message from a payload.
This is a move constructor so the the argument will be left in an empty state. If you do not want this .copy() otherwise use std::move()
com::softwareag::connectivity::Message::Message | ( | payload_t && | _payload, |
metadata_t && | _metadata | ||
) |
Construct a message from a payload and metadata.
This is a move constructor so the the argument will be left in an empty state. If you do not want this use .copy() otherwise use std::move()
com::softwareag::connectivity::Message::~Message | ( | ) |
Free the underlying payload and metadata.
com::softwareag::connectivity::Message::Message | ( | Message && | other | ) |
Move constructor from another message.
The argument will be left in an empty state. If you do not want this use .copy() otherwise use std::move().
|
inlinestatic |
Returns the metadata key used by the host for identifying the channel of the message - "sag.channel".
|
inlinestatic |
The metadata key indicating that a message is a control message, and what its type is.
The metadata value names the control message, with different types of control message defined in the CONTROL_TYPE_* constants.
Control messages must have a null payload.
|
inlinestatic |
Name of the AckRequired control message, a towards-host control message.
It is a request for the host to acknowledge that all previous towards-host non-control messages have been fully and reliably processed. Metadata of this control message should also contain the MESSAGE_ID of the immediately preceding non-control message.
|
inlinestatic |
Name of the AckUpTo control message, a towards-transport control message in response to AckRequired, containing the corresponding MESSAGE_ID.
AckUpTo messages will be seen in the exact order that their corresponding AckRequired messages were sent, with none missing or duplicated.
|
inlinestatic |
Name of the Flush control message, a towards-transport control message.
It is a request for the transport to acknowledge that all previous towards-transport non-control messages have been fully and reliably processed. Metadata of this control message will also contain a unique REQUEST_ID.
|
inlinestatic |
Name of the FlushAck control message, a towards-host control message in response to Flush, containing the corresponding REQUEST_ID.
FlushAck messages implicitly cover all preceding Flush messages. That is, it is safe to miss a Flush if you have a later Flush in hand that succeeds it.
|
inline |
Return a deep copy of this message, payload and metadata.
|
inline |
|
inline |
|
inline |
Return a view on the metadata which can contain non-string values.
|
inline |
Return a view on the metadata which can contain non-string values.
const payload_t& com::softwareag::connectivity::Message::getPayload | ( | ) | const |
Return a reference to the payload.
|
inline |
Return a reference to the payload.
|
inlinestatic |
Returns the metadata key used by the host for identifying the type of the message - "sag.type".
|
inlinestatic |
The metadata key used for unique identification of towards-host messages.
This is not mandatory, and only has to be populated for messages that you would like to see reliably acknowledged.
The identifier can be an arbitrary value of string type, and must uniquely identify a message within the scope of the chain and the lifetime of the system. That is, possibly across host reboots and reconnections. Where applicable you should use an id provided by the external messaging system. This will help traceability of messages.
Move assignment from another message.
The argument will be left in an empty state and our old contents freed. If you do not want this use .copy() otherwise use std::move().
|
inlinestatic |
The metadata key used for unique identification of towards-transport control messages, with a value of type int64_t.
Used to correlate Flush and FlushAck control messages.
void com::softwareag::connectivity::Message::setMetadata | ( | metadata_t && | _metadata | ) |
Set the metadata as metadata_t.
This is a move operation so the argument will be left in an empty state and the old metadata freed If you do not want this .copy() otherwise use std::move()
void com::softwareag::connectivity::Message::setMetadata | ( | map_t && | _metadata | ) |
void com::softwareag::connectivity::Message::setPayload | ( | payload_t && | _payload | ) |
Set the payload.
This is a move operation so the argument will be left in an empty state and the old payload freed If you do not want this .copy() otherwise use std::move()
void com::softwareag::connectivity::Message::swap | ( | Message && | other | ) |
Swap the contents of this message with another.