Link to home
Start Free TrialLog in
Avatar of websss
websssFlag for Kenya

asked on

write to MS message queue and retrieve it

Hi

I can successfully write to the MS message queue by doing this:
using (MessageQueue alertsQueue = new MessageQueue(Program.alertsQueuePath))
                {
                    BinaryMessageFormatter formatter = new BinaryMessageFormatter();
                    System.Messaging.Message message = new System.Messaging.Message(this, formatter);

                    alertsQueue.Send(message, "CommonObject");
                }

Open in new window


where "this" is a class called clsCommon.cs and is a populated object with values

Then on another console app, i need to read this message and i guess deserialise it
i.e.
   public void MqReceiveCompleted(object sender, ReceiveCompletedEventArgs e)
        {
            try
            {
                mq.EndReceive(e.AsyncResult);

                clsCommon objClsCommon = new clsCommon();
                string strObjClsCommon = e.Message.Body.ToString();

//here is need to convert the string I just got into objClsCommon

Open in new window


any ideas?
ASKER CERTIFIED SOLUTION
Avatar of Dirk Strauss
Dirk Strauss
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Only response provided. Serialization question answered by suggesting Newtonsoft.Json.