Fanout support?
Alexwijn opened this issue · 17 comments
I know this has been asked before, a year ago. But is there any plan to support the exchange type fanout again in the near future? Thanks!
I'm currenty making multiple microservices. And without the fanout exchange type I'm unable to send an event to all services.
You could say that I send it to one server at a time but the sender should not care in this instance who wants to know this event, only the receiver.
you mean you have several rabbitmq servers?
If you mean that you need to publish a message to several listeners, it currently works like this.
No, one rabbitmq server and multiple clients.
So It works as you described.
So with this package it is possible to send a payload from a client to the rabbitmq without knowing the receiver? The receiver could be multiple subscribers / clients.
That's why I was intrested in the fanout exchange type. But I do not see anything in your docs that you support that. And there is an old issue where it was stating that the fanout exchange was not supported anymore since v1.
That's correct. You're publishing a message that could be handled by many listeners. And Publisher doesn't care about those listeners.
Please give me a sentence that could correctly describe how actually system works and I'll add it.
Honestly, I was sure that this is clear.
When using the fanout exchange the microservices will be able to respond to it.
For example for when a user has been created multiple services need to do something to make sure they can handle the user.
The issue is that when not using the fanout exchange type is that only one microservice receives the event and not everyone.
It works exactly as you described with only difference: with fanout when a listener is not working ATM (a script has crashed, rebooting etc.) you'll lose messages. In the current implementation, you need only RabbitMQ working always. After a Listener reboot, all messages sent during this reboot will be sent to it.
As far as I know only one client can subscribe to a queue. So we need multiple queues. And the Topic Exchange Type does support to send it to all queues.
so you'll create a queue for each listener. Is that a problem? All of those queues could be subscribed to the same event
in our system we have about 300 listeners subscribed to 20 events
But who receive those 20 events. Are there multiple clients that process them at the same time? Or are those events send to a specific client / route?
exchange sends messages to all queues/listeners at the same time. Please check how binding works for topic.
in few words: You have an event app-name:item.created
, and 15 different apis that listening to it. You should run rabbitevents:listen item.created
command for each application. It will create 15 queues which named as api-name:item.created
.
When a message (item.created
with payload) has published, all 15 apis will receive this message.
Alright, I'll try out your package once I'm in the phase of communicating with other microservices.
I thought this was not possible except for the Fanout type. Thanks anyway!
Feel free to ask If anything is unclear. I'm closing this issue.