-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make remote worker connect to the RabbitMQ after restarting #211
Comments
I have known the way to fix the problem. Just initialize again. However, there are two points need to be concerned:
|
The wrapped function should be rewrite to reveal more error detail instead of only true or false. The error type is recorded in the structure amqp_rpc_reply_t and the possible error is listed in the amqp_status_enum. Currently we only focus on the error type of restarted RabbitMQ broker and recover remote worker with reinitialization. |
The reinitialization will be wrapped as an infinite loop which reinitializes until it is success. In remote worker, three RabbitMQ APIs should be handled well if error occurs. However, based on the document, amqp_basic_ack says
and amqp_basic_publish says
I will test the behaviour of the last two APIs when the RabbitMQ broker is stopped or restarted. |
Even if I close the RabbitMQ broker, the APIs amqp_basic_ack() and amqp_basic_publish() can return without error if the network sockets are not closed yet. When the network sockets are not closed yet, the first called API would return successfully. I am still trying to figure out the way to solve the problem. |
To close a socket, we need a four-way handshake. However, when I close the RabbitMQ broker, it does not wait and it just closes. There are other people encounter the same issue like me alanxz/rabbitmq-c#461. Another related issue: alanxz/rabbitmq-c#391. |
If the RabbitMQ is restarted, the remote worker will be closed.
We should modify the remote worker to make it keep trying to connect to the RabbitMQ when it is unavailable.
The text was updated successfully, but these errors were encountered: