I am starting with ActiveMQ in C#. I serialize my object to json and send it without problem.
I would add properties to my message but I don't succeed. I have seen the setIntProperty(String name,int value) on few websites but I don't find it on Apache.NMS.ActiveMQ (C#).
Here my code :
ActiveMQ mom = new ActiveMQ();
ISession session = mom.Initialize();
IDestination dest = session.GetQueue(queueDestination);
using (IMessageProducer producer = session.CreateProducer(dest))
{
foreach (Store s in stores)
{
List<string> matchKeyProductList = db.GetProductsKeyList(websiteNumberID);
ArrayList arCodesProdToUpdate = db.GetProductsToUpdate(websiteNumberID);
JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
serializer.MaxJsonLength = Int32.MaxValue; //Augmentation de la propriété MaxJsonLenth
MessageObject message = new MessageObject(matchKeyProductList, arCodesProdToUpdate);
string jsonMessage = serializer.Serialize(message);
ITextMessage textMessage = producer.CreateTextMessage(jsonMessage);
producer.Send(textMessage);
}
}
mom.Cleanup();
Can anyone help me with an example, please ?
ITextMessage
inherits from IMessage, which has a map of Properties, with several applicable set methods. You should be able to set these as follows, before sending: