سؤال

I want to add a class to the MessageContent of a MessageQueue before adding it in QueueStorage.

Example

class udpates
{
    public int userId {get; set; }
    public Datetime UpdateTime {get; set; }
}


queue.addMessage("instance of updates class")

How can i do that ?

thanks,

هل كانت مفيدة؟

المحلول

Queue messages are either string or binary. You could serialize the object yourself and then enqueue the result.

Personally, I prefer string-based queue messages, as I can easily debug issues by pulling messages from a queue and viewing them without needing to decode. Also, it's easy to update a queue message when it's a string.

نصائح أخرى

Serialize to XML string is a good option.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top