1

We have requirement to send header information too along with payload to Solace. How can we achieve this?

Solaceuser
  • 19
  • 2
  • Can you clarify which API (such as C, .NET, Java, MQTT, REST, etc) are you trying to use. Also, an example of your header would be helpful. – Russell Sim Apr 06 '16 at 08:00

1 Answers1

2

Solace messages allow users to set custom user property (a.k.a header) fields along with the message payload. It is usually required to first insert the desired headers into a Structured Data Map (SDTMap) and then set the SDTMap as the user property section of the message.


Java

XMLMessage.setProperties()

C

solClient_msg_createUserPropertyMap()

.NET

IMessage.CreateUserPropertyMap()

For the above 3 APIs, you might find the "Creating Custom Message Header Fields" section in the API guide useful. https://sftp.solacesystems.com/Portal_Docs/#page/Solace_Messaging_APIs_Developer_Guide/Using_Structured_Data.html#ww607779


JavaScript

message.setUserPropertyMap(map);

Silverlight

message.UserPropertyMap = map;

ActionScript

message.UserPropertyMap = map;

For Web-based APIs, you might find the "Creating User Property Maps" section in the Web Messaging API guide useful. https://sftp.solacesystems.com/Portal_Docs/#page/Solace_Web_Messaging_APIs_Developer_Guide/Using_Structured_Data_Types.html#ww619248


REST

Include a HTTP header of this format: Solace-User-Property-<name>: <value>

You will find "Solace Message Custom Properties" section of the Rest Messaging protocol guide helpful. https://sftp.solacesystems.com/Portal_Docs/#page/REST_Messaging_Protocol_Guide/2_Solace_REST_Message_Encoding.html#wwpID0E0DN0HA


JMS

Use standard JMS methods to set message headers. For example, Message.setStringProperty(String name, String value)

Russell Sim
  • 1,693
  • 2
  • 14
  • 22