Question

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,

Was it helpful?

Solution

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.

OTHER TIPS

Serialize to XML string is a good option.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top