此时,我的设计变体是:getallmsg in the queue and ACK msg,我想将其从队列中删除。在
这是我的简单客户代码:
from stompy import stomp
import json
s = stomp.Stomp(amq_ip, amq_port)
try:
s.connect(username=amq_user, password=amq_pass)
s.subscribe({'destination': '%s' % amq_queue, 'ack': 'client'})
except Exception as e:
print "ActiveMQ error\n %s" % e
while True:
try:
frame = s.receive_frame()
body = json.loads(frame.body)
# это сообщение для меня?
if body["interested_atr_in_msg"] == "interested_value_of_attr_in_msg":
print "Its for me. I receive it"
# Это сообщение для меня. Я его приму и обработаю
s.ack(frame)
else:
# Это сообщение предназначено для кого-то другого и мне не подходит
print "Its not for me"
except Exception as e:
print e
如何删除消息我知道,但只是理论上的(通过WireShark分析包流量的结果,工作浏览器在页面中本地主机:8161\admin在AMQ管理页面ActiveMQ),我不能以编程方式删除msg(Python)。在
理论上我可以在AMQ中用param.
[id,secret]
调用(我在packege中看到这个,packege在删除时发送到\admin AMQ)deleteMessage()
, 在哪里id
-队列\主题中消息的唯一名称secret
-唯一号码(可能是一些“令牌”),每次更新时都会更改(例如F5)\admin\browse页。我说不出是什么。。。。在请看图片:https://ru.stackoverflow.com/q/618697/228254在我的回答下来的帖子。在
示例测试队列:
此时,我的设计变体是:getallmsg in the queue and ACK msg,我想将其从队列中删除。在
这是我的简单客户代码:
还添加了从队列中删除消息的实验测试代码(不起作用,不删除)
^{pr2}$相关问题 更多 >
编程相关推荐