Creating Messages
Messages are explicitly created by client applications when publishing and are implicitly created by the Solace C API on matching message delivery.
The Solace C API allocates a memory buffer from heap storage to store and send and receive messages.
When creating messages, the following factors should be considered:
Message Ownership
When creating messages for publishing, the Solace C API uses a session-independent message ownership model. In this model, client applications can reuse messages between send operations. Messages are allocated on demand and are disposed explicitly by client applications when they are done with the messages.
To create session-independent messages, call solClient_msg_alloc(...). This allocates a memory buffer from heap storage to store and send and receive messages.
Related Samples
For an example of how to create session‑independent messages, see the DirectPubSub sample.
Message Types
The Solace C API supports different message types as defined by the message payloads.
The Solace C API defines only a single message type. A message payload can contain any combination of message types and classes by way of message helper functions.
Resetting Messages
When reusing a message in the session-independent message ownership model, you can release all memory associated with a message buffer so that the message buffer is reset to its original state (that is, as if it has just been allocated). All fields are reset to their default values.
To reset a message, call solClient_msg_reset(...).