Azure ServiceBus的消息中带有@strin3http//schemas.microsoft.com/2003/10/Serialization/�
2017-02-18 23:38
393 查看
今天碰到一个很讨厌的问题,使用nodejs 接收Azure service bus队列消息的时候,出现了:@strin3http//schemas.microsoft.com/2003/10/Serialization/�
如何产生的:
使用 C# 往队列中插入消息,使用 nodejs 读取消息。
出现乱码的原因:
写入消息使用AMQP对象进行序列化,读取的时候使用http进行传输。
解决办法:
写入的时候改用 stream 的方式写入而不是直接写入字符串。
Nodejs 接收部分:
stackoverflow 的个回答:
http://stackoverflow.com/questions/36307767/how-to-remove-strin3http-schemas-microsoft-com-2003-10-serialization-receive
http://stackoverflow.com/questions/33542509/interoperability-azure-service-bus-message-queue-messages
如何产生的:
使用 C# 往队列中插入消息,使用 nodejs 读取消息。
出现乱码的原因:
写入消息使用AMQP对象进行序列化,读取的时候使用http进行传输。
解决办法:
写入的时候改用 stream 的方式写入而不是直接写入字符串。
var obj = new { key = i, url = string.Format("http://item.m.jd.com/product/{0}.html", i) }; var bytes = Encoding.ASCII.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(obj)); var stream = new MemoryStream(bytes); //加入消息 messages.Add(new BrokeredMessage(stream));
Nodejs 接收部分:
//接收队列消息。 var serviceBusService = azure.createServiceBusService("..."); serviceBusService.receiveQueueMessage('1001', function (error, m) { console.log(m); }
stackoverflow 的个回答:
http://stackoverflow.com/questions/36307767/how-to-remove-strin3http-schemas-microsoft-com-2003-10-serialization-receive
http://stackoverflow.com/questions/33542509/interoperability-azure-service-bus-message-queue-messages
相关文章推荐
- Exception: 此消息的接收方不能理解来自命名空间“http://schemas.microsoft.com/ws/2 006/02/tx/oletx”的标头“OleTxTransaction”
- 出错信息:configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0
- XAML Namespace http://schemas.microsoft.com/expression/blend/2008 is not resolved
- winForm 读取Web.config 包含(xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0")
- VS 2003 的安装教程http://msdn.microsoft.com/zh-cn/vstudio/default.aspx
- Erro:Namespace http://schemas.microsoft.com/expression/blend/2008 is not resolved.
- Service Broker – EndDialog (http://schemas.microsoft.com/SQL/ServiceBroker/EndDialog)
- "IMEMode”属性无效 - 根据数据类型"http://schemas.microsoft.com/sharepoint/:IMEMode”,值""无效 - 枚举约束失败。
- <html xmlns:v="urn:schemas-microsoft-com:vml"Java软件制作全过程-----------------------工具installAnyWhere
- 关于http://schemas.microsoft.com/expression/blend/2008 is not resolved的问题
- wcf 跟踪和消息日志记录 :http://msdn.microsoft.com/zh-cn/library/ms751526.aspx
- C# Azure 消息队列ServiceBus (服务总线队列)
- XAML Namespace http://schemas.microsoft.com/expression/blend/2008 is not resolved
- There is not a header with name ServiceContext and namespace http://schemas.microsoft.com/sharepoint/servicecontext in the messa
- Teach Yourself Microsoft SharePoint 2003 in 10 Minutes
- 当您尝试通过使用 FrontPage 2003 或当您尝试导出 Web 部件编辑门户收到是类型 Microsoft.SharePoint.SoapServer.SoapServerException " Soap:Server 异常 " 消息
- sharepoint 当您尝试通过使用 FrontPage 2003 或当您尝试导出 Web 部件编辑门户收到是类型 Microsoft.SharePoint.SoapServer.SoapServerException " Soap:Server 异常 " 消息
- (sql2005)com.microsoft.sqlserver.jdbc.SQLServerException: 到主机 的 TCP/IP 连接失败。 java.net.ConnectException: Connection refused: con
- iOS 10 消息推送(UserNotifications)秘籍总结(一)
- 添加xmlns:android="http://schemas.android.com/apk/res/android"的意思