[英]How to pull the messages from Azure Service Bus Queue in Java?
I want to pull the messages from Azure service bus queue. 我想从Azure服务总线队列中提取消息。 I can pull it from the sample code provided here .
我可以从此处提供的示例代码中提取它。 The messages which are coming are coming line by line.
即将来临的消息正在逐行传出。 In my case I need the entire message at once.
就我而言,我需要一次完整的消息。 How to do it?
怎么做?
@AnandDeshmukh, there are two way to pull messages from Azure Service Bus Queue, which include AMQP with JMS , REST API via HTTP . @AnandDeshmukh,有两种方法可以从Azure服务总线队列中提取消息,包括AMQP和JMS以及通过HTTP的REST API 。
I see you are using Azure Service Bus SDK for Java when you are refering to the tutorial to pull messages. 当您参考教程提取消息时,我看到您正在使用Azure Service Bus SDK for Java。 According to the source codes of the SDK for Java on GitHub, you can discover that the SDK just wrapped the related REST APIs which only get a message via HTTP protocol at a time.
根据GitHub上Java版SDK的源代码 ,您会发现SDK只是包装了相关的REST API,这些REST API一次只能通过HTTP协议获取消息。
Although I don't know what your application scene is, if you want high performance for receiving messages, I recommend the better way is using AMQP for getting messages from queue. 尽管我不知道您的应用程序场景是什么,但是如果您想要高性能来接收消息,我建议更好的方法是使用AMQP从队列中获取消息。 AMQP is a binary, application layer protocol, designed to efficiently support a wide variety of messaging applications and communication patterns, please see https://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol to know it.
AMQP是二进制的应用程序层协议,旨在有效地支持各种消息传递应用程序和通信模式,请参见https://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol进行了解。
You can not get all messages at once but you can always make their batch(session) to deliver at once. 您不能一次获得所有消息,但始终可以使它们的批处理(会话)立即发送。 For enabling session in service bus you need to do two changes.
要在服务总线中启用会话,您需要进行两项更改。
1. While creating service bus chose to Enable Session 2. While pushing messaging to Service Bus set property SessionId of Message to same id for a batch
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.