HareMq.Worker.Consumer
(hare_mq v1.4.0)
Copy Markdown
Internal GenServer that manages a single AMQP channel and processes messages.
Not intended to be used directly — instantiated by HareMq.Consumer and
HareMq.DynamicConsumer macros.
Lifecycle
- On
init/1sends itself{:connect, opts}. - Opens a channel on the active
HareMq.Connection. - Calls
declare_queues/1— for stream queues onlyx-queue-type: streamis declared; standard queues get the full exchange + delay + dead-letter topology. - Calls
Basic.consume/3— stream consumers passx-stream-offsetin the arguments; standard consumers use no extra arguments. - On graceful cancel or channel/connection drop the GenServer stops and is restarted by its supervisor.
Stream behaviour
When config[:stream] is true:
- Only the main queue is declared (
x-queue-type: stream). Basic.consume/3includes thex-stream-offsetargument derived fromconfig[:stream_offset](string, integer, or%DateTime{}).process_result/5always acks regardless of theconsume_fnreturn value — stream logs are immutable so nack/retry is meaningless.
Summary
Functions
Returns a specification to start this module under a supervisor.
Callback implementation for GenServer.init/1.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Callback implementation for GenServer.init/1.