Creating Messages
Messages are explicitly created by client applications when publishing and are implicitly created by the Solace Messaging API for JavaScript on matching message delivery.
The Solace JavaScript API and Solace Node.js API create a solace.Message object to encapsulate a message.
When creating messages, the following factors should be considered:
Message Ownership
When creating messages for publishing, the Solace JavaScript API and Solace Node.js API use 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 a session-independent message, call solace.SolclientFactory.createMessage() to create a solace.Message object to encapsulate a message.
Message Types
The Solace JavaScript API and Solace Node.js API define only a single message type. A message payload can contain any combination of the message types and classes listed above 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 solace.Message.reset().