Adding Data Payloads
You can add the following types of payloads to a message:
- XML content—XML data can be added to the XML content part of a message.
- Binary content—Binary data can be added to a message as a binary attachment. A message can only contain a single attachment.
When this attachment is sent through the event broker, it is not processed, transformed, or considered in subscription matching or filtering operations. This provides an efficient means for sending data that does not require processing by the platform before it reaches receiving applications.
Structured data can also be added as a payload in the binary attachment (refer to Using Structured Data).
- User Property Map—Structured data can be added to user-defined message header fields.
- User Data—Up to 36 bytes of application‑specific binary data, known as user data, can be added to the User Data message header field.
The maximum total size permitted for a published Direct message is 64 MiB (67,108,864 bytes). This is an event broker-imposed limit, and it takes into consideration the message header field data, XML metadata, XML payload, and any attachments.
PubSub+ Messaging API | Data Type To Add | Set Through |
---|---|---|
Java RTO |
XML Data |
Not applicable |
Binary Data |
MessageHandle.setBinaryAttachment(...) |
|
User Data |
MessageHandle.setUserData(...) |
|
C |
XML Data |
|
Binary Data |
You can also add structured data to the payload in the binary attachment; refer to Using Structured Data. |
|
User Data |
|
|
.NET |
XML Data |
IMessage.XmlContent |
Binary Data |
IMessage.BinaryAttachment |
|
User Data |
IMessage.UserData |
|
JavaScript and Node.js |
XML Data |
solace.Message.setXmlContent(...) |
Binary Data |
|
|
User Data |
solace.Message.setUserData(...) |
Related Samples
- For an example of how to add a binary data payload to a message, refer to
DirectPubSub
for the Java RTO, C, and .NET APIs, and theTopicPublisher
sample for the JavaScript and Node.js APIs. - For an example of how to add SDT payloads to a message, refer to the
SDTPubSubMsgIndep
orSDTPubSubMsgDep
samples for the Java RTO, C, and .NET APIs, and theBasicRequestor
andBasicReplier
samples for the JavaScript and Node.js APIs.- In the
SDTPubSubMsgIndep
sample, SDT containers are created using application memory (allowed by the C and .NET APIs). - In the
SDTPubSubMsgDep
sample, SDT containers are created using API-controlled memory (allowed only by the C and .NET APIs).
For more information on creating SDT containers with application memory or API-controlled memory, refer to Using Structured Data.
- In the