My configuration:
Running qpidd on host: 192.168.80.81 with following exchanges (qpid-config exchanges
):
Type Exchange Name Attributes
==================================================
direct --replicate=none
direct amq.direct --durable --replicate=none
fanout amq.fanout --durable --replicate=none
headers amq.match --durable --replicate=none
topic amq.topic --durable --replicate=none
direct qmf.default.direct --replicate=none
topic qmf.default.topic --replicate=none
topic qpid.management --replicate=none
I have multiple producers publishing to the topics like amq.topic/com.product.sample1
, amq.topic/com.product.sample2
, you get the pattern.
I can receive all messages from the producers by running qpid-receive -b 192.168.80.81 -a amq.topic/com.product.sample1 -f
on the commandline.
But when it comes to implementing this in Python using the python-qpid-proton library (version 0.35.0) it wont work as needed. This is my python file to receive messages on a specific topic:
from proton.handlers import MessagingHandler
from proton.reactor import Container
broker_url = "192.168.80.81:5672"
topic = "amq.topic/com.product.sample"
class Client(MessagingHandler):
def __init__(self, broker_url, topic):
super(Client, self).__init__()
self.broker_url = broker_url
self.topic = topic
def on_start(self, event):
conn = event.container.connect(self.broker_url)
self.receiver = event.container.create_receiver(
conn, self.topic, dynamic=True)
def on_message(self, event):
print(event.message.body)
Container(Client(broker_url, topic)).run()
Can anyone help me and point me to where my mistake is? Help is much appreciated!