Message Queue or an Event Bus system?

Hello everybody,

I tend to see Message Queues (like RabbitMQ) being relevant when we want to make communicate different apps through events (the apps might be running on different servers or as microservices or even on client apps).

However (and hopefully) with Elixir apps I tend to have one single “app” (maybe umbrella apps) and in this case the Message Queue system might be more of what we are calling an Event Bus…

So I wanted to know if it still makes sense to use a Message Queues (like RabbitMQ) in this context?
Or does it better to use some kind of Elixir baked solutions (GenServers, Phoenix PubSub, some external library like event_bus)?

I would love to hear if you are using Event Bus and if so what you are using?

1 Like

If you decide to hide it behind some kind of interface (e.g. MyApp.EventBus) you can pick whatever tool works for you. Then I think it boils down to whether you need persistent events and the expectations towards latency between sending and receiving the event.

2 Likes

Umbrellas don’t prevent you from sending messages to other processes without using any external message queue software.

As @stefanchrobot said, it depends if you want persistence. If you don’t, plain old GenServers will serve you more than adequately enough.

1 Like

I think if you’re crossing lines – where a line might be a different language, a different node, a different speed of execution – then something like RabbitMQ might be a better choice. It’s got clients in lots of different languages.

5 Likes