achilleasa / dart_amqp

Dart AMQP client implementing protocol version 0.9.1
MIT License
79 stars 40 forks source link

Can i listen a topic with this plugin? #74

Closed barangungor closed 2 years ago

barangungor commented 2 years ago

I want listen a topic from my app. Can i do that?

achilleasa commented 2 years ago

Take a look in the example folder. This example in particular demonstrates how to listen to a particular topic in a pubsub scenario.

barangungor commented 2 years ago

I saw that, but it look like listen a queue. Should i use Exchange if i want listen a topic?

achilleasa commented 2 years ago

In the linked example, the exchange will fan out a copy of each message to each subscribed (private) queue. The main idea here is that each consumer defines a private queue to ensure that they get a copy for every message published to the exchange as you would expect in a pubsub scenario.

See the "fanout exchange routing" section in the rabbit docs for more details on how this works.