MQTT的学习研究(九)基于HTTP GET MQTT 抓取消息服务端使用
来源:互联网 发布:淘宝卖家违规扣分 编辑:程序博客网 时间:2024/06/06 17:45
官方参看文档:
HTTP GET 接收主题请求协议和响应协议
http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/topic/com.ibm.mq.csqzau.doc/ts21230_.htm
HTTP POST 发布主题请求协议和响应协议
http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/topic/com.ibm.mq.csqzau.doc/ts21220_.htm
HTTP DELETE 订阅主题请求协议和响应协议
http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/topic/com.ibm.mq.csqzau.doc/ts21240_.htm
请求响应头各个字段的含义的讲解
http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/topic/com.ibm.mq.csqzau.doc/ts21250_.htm
响应错误处理
http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/topic/com.ibm.mq.csqzau.doc/ts21340_.htm
HTTP GET: WebSphere MQ bridge for HTTP command
The HTTP GET operation gets a message from a WebSphere® MQ queue. The message is left on the queue. The HTTP GET operation is equivalent to browsing a WebSphere MQ queue.
Syntax
Request>>-+-DELETE-+-- --| Path |-- --HTTP version--CRLF---------------> '-GET----' .-CRLF---------------. .-CRLF---------------. V | V | >----+----------------+-+----+----------------+-+---------------> '-general-header-' '-request-header-' .-CRLF----------------------------. V | >----+-----------------------------+-+------------------------->< '-| Entity-header (Request) |-' Path|--/--contextRoot--/-------------------------------------------->>--msg/--+-queue/--queueName--+-------------+-+--/--------------| | '-@--qMgrName-' | '-topic/--topicName------------------' entity-header (Request)|--+----------------------------------------------+-------------| +-standard entity-header-- --entity-value------+ +-x-msg-correlId - --correlation ID------------+ +-x-msg-msgId - --message ID-------------------+ +-x-msg-range-- --range------------------------+ +-x-msg-require-headers-- --entity header name-+ '-x-msg-wait - --wait time---------------------'
- If a question mark (?) is used it must be substituted with %3f. For example, orange?topic should be specified as orange%3ftopic.
- @qMgrName is only valid on an HTTP POST
Response>>-HTTP version-- --HTTP Status-Code-- --HTTP Reason-Phrase--CRLF--> .-CRLF---------------. .-CRLF----------------. V | V | >----+----------------+-+----+-----------------+-+--------------> '-general-header-' '-response-header-' .-CRLF-----------------------------. V | >----+------------------------------+-+--+---------------+----->< '-| Entity-header (Response) |-' '-CRLF--Message-' entity-header (Response)|--+-----------------------------------------+------------------| +-standard entity-header-- --entity-value-+ +-x-msg-class-- --message type------------+ +-x-msg-correlId-- --correlation ID-------+ +-x-msg-encoding-- --encoding type--------+ +-x-msg-expiry-- --duration---------------+ +-x-msg-format-- --message format---------+ +-x-msg-msgId-- --message ID--------------+ +-x-msg-persistence-- --persistence-------+ +-x-msg-priority-- --priority class-------+ +-x-msg-replyTo-- --reply-to queue--------+ +-x-msg-timestamp-- --HTTP-date-----------+ '-x-msg-usr-- --user properties-----------'
HTTP GET example
HTTP GET gets a message from a queue. The message remains on the queue. In WebSphere MQ terms, HTTP GET is a browse request. You could create an HTTP DELETE request using a Java client, a browser form, or an AJAX toolkit.
Figure 1 is an HTTP request to browse the next message on queue called myQueue.
The request contains the HTTP request header x-msg-wait, which instructs WebSphere MQ bridge for HTTP how long to wait for a message to arrive on the queue. The request also contains the x-msg-require-headersrequest header, which specifies that the client is to receive the message correlation ID in the response.
GET /msg/queue/myQueue/ HTTP/1.1Host: www.example.orgx-msg-wait: 10x-msg-require-headers: correlID
Figure 2 is the response returned to the client. The correlation ID is returned to the client, as requested in x-msg-require-headers of the request.
HTTP/1.1 200 OKDate: Wed, 2 Jan 2007 22:38:34 GMTServer: Apache-Coyote/1.1 WMQ-HTTP/1.1 JEE-Bridge/1.1Content-Length: 50Content-Type: text/plain; charset=utf-8x-msg-correlId: 1234567890Here's my message body that will appear on the queue.
- MQTT的学习研究(九)基于HTTP GET MQTT 抓取消息服务端使用
- MQTT的学习研究(九)基于HTTP GET MQTT 抓取消息服务端使用
- MQTT的学习研究(七)基于HTTP POST MQTT 发布消息服务端使用
- MQTT的学习研究(八)基于HTTP DELETE MQTT 订阅消息服务端使用
- MQTT的学习研究(七)基于HTTP POST MQTT 发布消息服务端使用
- MQTT的学习研究(八)基于HTTP DELETE MQTT 订阅消息服务端使用
- MQTT的学习研究(五) MQTT moquette 的 Blocking API 发布消息服务端使用
- MQTT的学习研究(5) MQTT moquette 的 Blocking API 发布消息服务端使用
- MQTT的学习研究(六) MQTT moquette 的 Blocking API 订阅消息客户端使用
- MQTT的学习研究(六) MQTT moquette 的 Blocking API 订阅消息客户端使用
- MQTT的学习研究(6)MQTT 订阅消息客户端使用
- MQTT的学习研究(二)moquette-mqtt 的使用之mqtt broker的启动
- MQTT的学习研究(2)moquette-mqtt 的使用之mqtt broker的启动
- MQTT的学习研究(三)moquette-mqtt 的使用之mqtt服务发布主题信息
- MQTT的学习研究(3)moquette-mqtt 的使用之mqtt服务发布主题信息
- MQTT的学习研究(十二) MQTT moquette 的 Future API 消息发布订阅的实现
- MQTT的学习研究(十四) MQTT moquette 的 Callback API 消息发布订阅的实现
- MQTT的学习研究(十二) MQTT moquette 的 Future API 消息发布订阅的实现
- 黑马程序员之7k面试题之银行业务调度系统
- setup time & hold time
- LeetCode 之 Letter Combinations of a Phone Number
- java模板代码
- C# 事件委托 【开门两次 开枪】
- MQTT的学习研究(九)基于HTTP GET MQTT 抓取消息服务端使用
- “corruption in the heap” vector内存释放错误
- UIAlertView笔记
- C++标准库类型(转)
- 算法导论第15章 最优二叉树
- javascript获取光标位置以及设置光标位置(兼容firefox)
- 迭代器是什么
- 一,关于struts.xml参数
- 对“Halcon视频教程第一章 第二节”的学习感悟