简体   繁体   English

如何以json格式获取Azure Service Bus队列响应

[英]how to get Azure Service Bus Queue response in json format

As I am new to Microsoft Azure. 我是Microsoft Azure的新手。 I just wanna know that how to get the response(receiving message) form the service bus queue in the JSON format. 我只是想知道如何以JSON格式从服务总线队列中获取响应(接收消息)。

Is their is any way to do so? 他们有办法吗?

Please suggest with your valuable suggestion. 请提出您的宝贵建议。

 For an example: var getToken = function (queueName) { var uri = "http://" + serviceNamespace + environment + "/" + queueName; var endocedResourceUri = encodeURIComponent(uri.toLowerCase()); var t0 = new Date(1970, 1, 1, 0, 0, 0, 0); var t1 = new Date(); var expireInSeconds = +(31 * 24 * 3600) + 3600 + (((t1.getTime() - t0.getTime()) / 1000) | 0); var plainSignature = endocedResourceUri.toLowerCase() + "\\n" + expireInSeconds; var hash = CryptoJS.HmacSHA256(plainSignature, sasKey); var base64HashValue = CryptoJS.enc.Base64.stringify(hash); var str = encodeURIComponent(base64HashValue); str = str.replace("%3D", "%3d"); var token = "SharedAccessSignature sr=" + endocedResourceUri.toLowerCase() + "&sig=" + str + "&se=" + expireInSeconds + "&skn=" + sasKeyName; return token; } 

https://github.com/ddobric/ServiceBusJavaScriptSdk/blob/master/ServiceBusJS/Scripts/servicebusjssdk-1.2.js https://github.com/ddobric/ServiceBusJavaScriptSdk/blob/master/ServiceBusJS/Scripts/servicebusjssdk-1.2.js

Additional information: http://fabriccontroller.net/iot-with-azure-service-bus-event-hubs-authenticating-and-sending-from-any-type-of-device-net-and-js-samples/ 附加信息: http : //fabriccontroller.net/iot-with-azure-service-bus-event-hubs-authenticating-and-send-from-any-type-of-device-net-and-js-samples/

Documentation has a lot of information. 文档中有很多信息。 As you've tagged Java, I assume you're looking on how to send/receive messages using Java client. 正如标记了Java一样,假定您正在研究如何使用Java客户端发送/接收消息。 A good starting point would be this documentation . 一个很好的起点是本文档

Content (body/payload) of Azure Service Bus message is stored in whatever format the original message was sent in. You can't pick a format and retrieve message body in that format. Azure Service Bus消息的内容(正文/有效负载)以原始邮件发送的任何格式存储。您无法选择一种格式并以该格式检索消息正文。 Depending on the original message was sent (using stream or an object) and the client, you'll have to receive the message and de-serialize it. 根据发送的原始消息(使用流或对象)和客户端,您将不得不接收消息并将其反序列化。

Another great resource is GitHub repo with Azure Service Bus samples in Java . 另一个很棒的资源是带有Java的 Azure Service Bus 示例的 GitHub存储库。

This should help you to familiarize yourself with Azure Service Bus and its Java Client. 这应该有助于您熟悉Azure Service Bus及其Java客户端。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从Java中的Azure Service Bus队列中提取消息? - How to pull the messages from Azure Service Bus Queue in Java? 如何实现 azure 服务总线队列触发/存储连接错误 - how to implement an azure service bus queue trigger / storage connection error 如何使用 Java 在 Azure 服务总线中创建队列? - How to create a Queue in Azure Service Bus using Java? 互操作性 Azure 服务总线消息队列消息 - Interoperability Azure Service Bus Message Queue Messages 如何在azure服务总线中一直监听队列并拦截每条消息 - How to listen a queue all the time in azure service bus and intercept each message 我们如何使用 java 对 azure 服务总线队列中存在的消息添加延迟? - How can we add a delay on the message which is present in azure service bus queue using java? 如何将消息直接发送到 azure 服务总线(java)中的死信队列? - How can I send a message directly into a dead letter queue in azure service bus (java)? 如何使用 Java SDK 从我的远程 Azure 应用程序配置中检索服务总线队列的队列名称? - How can I retrieve the queue name for a service bus queue from my remote Azure App Configuration using the Java SDK? Java:Azure 服务总线队列通过会话接收消息 - Java: Azure Service Bus Queue Receiving messsages with sessions Java:从Windows Azure服务总线队列接收答案 - Java: Receive answer from Windows Azure Service Bus Queue
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM