with azure brokeredmessage get the body without knowing the type

后端 未结 3 766
一个人的身影
一个人的身影 2021-01-30 14:03

When you are using the brokered message in the Azure Service Bus, you can retrieve the body of the message with the call .GetBody. The code is simple:

var msg =         


        
3条回答
  •  面向向阳花
    2021-01-30 14:15

    If the intent is to only grab the message body regardless of the content you can get it as a stream.

    Stream stream = message.GetBody();
    StreamReader reader = new StreamReader(stream);
    string s = reader.ReadToEnd();
    

提交回复
热议问题