Menu Search

selected_recv.py

from __future__ import print_function
from proton.reactor import Container, Selector
from proton.handlers import MessagingHandler

class Recv(MessagingHandler):
    def __init__(self):
        super(Recv, self).__init__()

    def on_start(self, event):
        conn = event.container.connect("localhost:5672")
        event.container.create_receiver(conn, "examples", options=Selector("colour = 'green'"))

    def on_message(self, event):
        print(event.message.body)

try:
    Container(Recv()).run()
except KeyboardInterrupt: pass

Download this file