Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 errorn %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
Add Comment
Please, Sign In to add comment