Flux AMQP v0.0.1 FluxAMQP.Consumer behaviour View Source
Module responsible to consume AMQP messages.
The main approach to consume is done by defining a module which use FluxAMQP.Consumer
and implements routing_keys/0
and consume/3
functions:
defmodule MyApp.AMQP.Consumer do
use FluxAMQP.Consumer
@impl FluxAMQP.Consumer
def routing_keys do
[
"route.example",
{"another.route.example", "amq.direct"}
]
end
@impl FluxAMQP.Consumer
def consume(channel, delivery_tag, routing_key, payload) do
# Handle message
end
end
If routing_keys/0
returns an empty list, FluxAMQP
will try to extract the routing keys
from the application :flux_amqp
configuration.