[英]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.