Send a message with a new library (Microsoft.Azure.ServiceBus) that is read by an old library (Microsoft.ServiceBus.Messaging) with BodyType - String

99封情书 提交于 2019-11-28 14:17:26

The scenario is described here. You will need to serialize the message following this approach:

 var serializer = DataContractBinarySerializer<string>.Instance; 
 using (MemoryStream stream = new MemoryStream()) 
 {
     serializer.WriteObject(stream, some_string);
     var msg = new Message(stream.ToArray());
     var client = new Microsoft.Azure.ServiceBus.QueueClient(ConnectionString, Queue);
     await client.SendAsync(msg);
     await client.CloseAsync(); 
 }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!