This is a little PSA… I should submit a PR for the docs, but here it is for the forum: how to bind a queue to an exchange using amqp
:
{:ok, connection} = AMQP.Connection.open([])
{:ok, channel} = AMQP.Channel.open(connection)
:ok = AMQP.Exchange.declare(channel, "my_exchange", :headers) do
AMQP.Queue.declare(channel, "my_queue", durable: true)
AMQP.Queue.bind(channel, "my_queue", "my_exchange", arguments: [
{"my_head", :longstr, "some_val"},
{"x-match", :longstr, "all"}
])