freddy v0.14.0 Freddy.Adapter behaviour
An interface for AMQP layer
Link to this section Summary
Callbacks
Acks a message
Binds given exchange to another exchange
Binds given queue to the exchange
Closes existing channel
Closes AMQP connection
Registers given pid as a consumer from a queue
Declares exchange of the given type on the channel
Declares queue with the given name on the channel
Transforms a message received by a consumed pid into one of the well defined terms expected by consumers. The expected terms are:
{:consume_ok, meta}
-consume-ok
message sent by the AMQP server when a consumer is started{:deliver, payload, meta}
- an actual message from the queue being consumed{:cancel_ok, meta}
-cancel-ok
message sent by the AMQP server when a consumer is started{:cancel, meta}
-cancel
message sent by the AMQP server when a consumer has been unexpectedly closed{:return, payload meta}
-return
message sent by the AMQP server when message could not be routed:unknown
- any other message
Links current process to a connection
Sets up a monitor on a channel
Nacks a message
Opens new channel on connection
Opens AMQP connection with given options. Return {:ok, connection}
on success
or {:error, reason}
on failure
Publishes a message to an exchange
Set up channel QoS
Registers given process as a return handler for the given channel
Rejects a message
Link to this section Types
Link to this section Callbacks
ack(channel(), delivery_tag(), options()) :: :ok | {:error, error()}
Acks a message
bind_exchange( channel(), destination :: exchange_name(), source :: exchange_name(), options() ) :: :ok | {:error, error()}
Binds given exchange to another exchange
bind_queue(channel(), queue_name(), exchange_name(), options()) :: :ok | {:error, error()}
Binds given queue to the exchange
Closes existing channel
close_connection(connection()) :: :ok | {:error, error()}
Closes AMQP connection
consume(channel(), queue_name(), consumer :: pid(), options()) :: {:ok, consumer_tag()} | {:error, error()}
Registers given pid as a consumer from a queue
declare_exchange(channel(), exchange_name(), exchange_type(), options()) :: :ok | {:error, error()}
Declares exchange of the given type on the channel
declare_queue(channel(), queue_name(), options()) :: {:ok, queue_name()} | {:error, error()}
Declares queue with the given name on the channel
Transforms a message received by a consumed pid into one of the well defined terms expected by consumers. The expected terms are:
{:consume_ok, meta}
-consume-ok
message sent by the AMQP server when a consumer is started{:deliver, payload, meta}
- an actual message from the queue being consumed{:cancel_ok, meta}
-cancel-ok
message sent by the AMQP server when a consumer is started{:cancel, meta}
-cancel
message sent by the AMQP server when a consumer has been unexpectedly closed{:return, payload meta}
-return
message sent by the AMQP server when message could not be routed:unknown
- any other message
Links current process to a connection
Sets up a monitor on a channel
nack(channel(), delivery_tag(), options()) :: :ok | {:error, error()}
Nacks a message
open_channel(connection()) :: {:ok, channel()} | {:error, error()}
Opens new channel on connection
open_connection(options() | String.t()) :: {:ok, connection()} | {:error, error()}
Opens AMQP connection with given options. Return {:ok, connection}
on success
or {:error, reason}
on failure.
publish(channel(), exchange_name(), routing_key(), payload(), options()) :: :ok | {:error, error()}
Publishes a message to an exchange
Set up channel QoS
Registers given process as a return handler for the given channel
reject(channel(), delivery_tag(), options()) :: :ok | {:error, error()}
Rejects a message