How to send the header along with payload in Solace

浪子不回头ぞ 提交于 2019-12-12 01:54:33

问题


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


回答1:


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)



来源:https://stackoverflow.com/questions/36443418/how-to-send-the-header-along-with-payload-in-solace

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!