Answer the question
In order to leave comments, you need to log in
What to do if the RabbitMq server is not available?
Hello! Advise ways to solve this problem:
Suppose a user creates a post, while saving it on the server, I generate a message in the RabbitMq message queue that a new post has been created, which means that all notifications (Push, Email, etc.) .)
But for some reason the RabbitMq server turned out to be not running or it is not responding or something else, but the bottom line is that when you try to connect, an error 500 will fly out, respectively, the user will see an error.
If it is processed so that it does not crash, then the message will still not be delivered to the consumer. It turns out that the user created a post, but no one will receive notifications.
What are the ways out of this situation?
Maybe such messages are stored in the database, and then when the server and consumers are started, we try to pull messages from the database with some third-party script and throw them back into RabbitMq?
Answer the question
In order to leave comments, you need to log in
You can do it in different ways, depending on the requirements, but it is good practice to check all necessary connections before starting to execute business logic. If something doesn't work, inform the user that the functionality is not available. In general, from such cases, Cluster RabbitMQ is installed from at least 2 nodes. It makes sense to save messages somewhere else very rarely and only for non-critical data
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question