Coney.ConnectionServer (coney v3.0.2)

Handles connections between ConsumerServer and the RabbitMQ instance(s).

This module abstracts away the connection status of RabbitMQ. Instead, when a new ConsumerServer is started, it requests ConnectionServer to open a channel. ConnectionServer opens a real amqp channel, keeps a reference to it in its state and returns an erlang reference to ConsumerServer. When ConsumerServer replies (ack/reject) an incoming RabbitMQ message it sends the erlang reference to ConnectionServer and then ConnectionServer looks up the real channel.

ConnectionServer can handle RabbitMQ disconnects independently of ConsumerServer. When connection is lost and then regained, ConnectionServer simply updates its map of {erlang_ref, AMQP.Connection}, ConsumerServer keeps using the same erlang_ref.

Summary

Functions

Link to this function

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

confirm(channel_ref, tag)

@spec confirm(reference(), any()) :: :confirmed
Link to this function

publish(exchange_name, message)

@spec publish(String.t(), any()) :: :published
Link to this function

publish(exchange_name, routing_key, message)

@spec publish(String.t(), String.t(), any()) :: :published
Link to this function

reject(channel_ref, tag, requeue)

@spec reject(reference(), any(), boolean()) :: :rejected
Link to this function

start_link(list)

Link to this function

subscribe(consumer)

@spec subscribe(any()) :: reference()