문제

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