Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using RabbitMQ (or pub/sub) for variables

I have an event (say activity) which may be active or not at a given time. I'm looking for a way to use RabbitMQ to figure if the event is active or not. I know the use case of RabbitMQ is pub/sub. How do I use RabbitMQ to be able to say if an event is currently active or not. More like a variable which is updated in real-time. I know I can achieve this using Firebase Database; but is there any way I can do it using RabbitMQ? If not RabbitMQ, are there any other suggestions? I cannot use mySQL etc. because that will not be real-time.

like image 518
Alec Smart Avatar asked Aug 29 '18 11:08

Alec Smart


1 Answers

RabbitMQ is a message broker, it is not suited for representing state across distributed systems.

For this purpose, I'd rather recommend any storage solution which provides transactions (SQL or NoSQL) as what you really want to ensure is the data is set atomically.

Solutions such as Redis, MongoDB, PostgreSQL are all providing what you need. Cloud providers nowadays offer similar solutions as managed services.

If latency when accessing the state is critical within your application (if this is what you mean with "Real Time"), then you will need to carefully consider your architecture. As the state will be stored in a remote location (be it RabbitMQ, Redis or whatever else), the network latency and it's (un)reliability will be the most important factor.

like image 148
noxdafox Avatar answered Sep 29 '22 00:09

noxdafox