[ https://issues.apache.org/jira/browse/PROTON-2469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17448727#comment-17448727 ]
Andreas Waider commented on PROTON-2469: ---------------------------------------- Thank you so much for your fast and excellent feedback! This solved my issue. I'm just wondering, what went wrong when I tried to subscribe to "amq.topic" and print all messages. But if it work it works :) > How to use proton-python properly to receive messages > ----------------------------------------------------- > > Key: PROTON-2469 > URL: https://issues.apache.org/jira/browse/PROTON-2469 > Project: Qpid Proton > Issue Type: Bug > Components: python-binding > Reporter: Andreas Waider > Priority: Major > > 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](https://pypi.org/project/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! -- This message was sent by Atlassian Jira (v8.20.1#820001) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org