Amqpx.DirectConsumer (amqpx v6.0.3)
This module "wraps" the amqp_direct_consumer module to manage the race condition that occurs at supervisor shutdown, leading to error logs such as:
[error] GenServer #PID<0.846.0> terminating
** (stop) {:error, {:consumer_died, :shutdown}}
Last message: {:DOWN, #Reference<0.1010163881.3799777283.106124>, :process, #PID<0.798.0>, :shutdown}.
The reason for this behavior is that the amqp_direct_consumer
module considers any exit reason other than :normal
as an error, prompting it to exit.
In our implementation, we have introduced two pattern matches to treat the exit reasons :shutdown
and {:shutdown, reason}
as normal occurrences; these conditions typically arise when the supervisor terminates the consumer, such as during a standard shutdown of the application."
Summary
Functions
Callback implementation for :amqp_gen_consumer.handle_call/3
.
Callback implementation for :amqp_gen_consumer.handle_cancel/2
.
Callback implementation for :amqp_gen_consumer.handle_cancel_ok/3
.
Callback implementation for :amqp_gen_consumer.handle_consume/3
.
Callback implementation for :amqp_gen_consumer.handle_consume_ok/3
.
Callback implementation for :amqp_gen_consumer.handle_deliver/3
.
Callback implementation for :amqp_gen_consumer.handle_deliver/4
.
Callback implementation for :amqp_gen_consumer.handle_info/2
.
Callback implementation for :amqp_gen_consumer.handle_server_cancel/2
.
Callback implementation for :amqp_gen_consumer.init/1
.
Callback implementation for :amqp_gen_consumer.terminate/2
.
Functions
handle_call(m, a, c)
Callback implementation for :amqp_gen_consumer.handle_call/3
.
handle_cancel(m, c)
Callback implementation for :amqp_gen_consumer.handle_cancel/2
.
handle_cancel_ok(m, a, c)
Callback implementation for :amqp_gen_consumer.handle_cancel_ok/3
.
handle_consume(m, a, c)
Callback implementation for :amqp_gen_consumer.handle_consume/3
.
handle_consume_ok(m, a, c)
Callback implementation for :amqp_gen_consumer.handle_consume_ok/3
.
handle_deliver(m, a, c)
Callback implementation for :amqp_gen_consumer.handle_deliver/3
.
handle_deliver(m, a, delivery_ctx, c)
Callback implementation for :amqp_gen_consumer.handle_deliver/4
.
handle_info(m, c)
Callback implementation for :amqp_gen_consumer.handle_info/2
.
handle_server_cancel(m, c)
Callback implementation for :amqp_gen_consumer.handle_server_cancel/2
.
init(opts)
Callback implementation for :amqp_gen_consumer.init/1
.
terminate(reason, c)
Callback implementation for :amqp_gen_consumer.terminate/2
.