freddy v0.9.0 Freddy.Notifications.Listener
Freddy.Consumer special case. Listens for notifications from “freddy-topic” exchange.
Like in Freddy.Consumer
, you have to specify routing keys to bind to.
Example:
defmodule Notifications.Listener do
use Freddy.Notifications.Listener
@config [
queue: [name: "myapp-notifications", opts: [auto_delete: true]],
routing_keys: ["broadcast.*"]
]
def start_link(conn, initial) do
Freddy.Notifications.Listener.start_link(__MODULE__, conn, @config, initial)
end
end
See also documentation for Freddy.Consumer
Link to this section Summary
Functions
Start a Freddy.Notifications.Listener
process linked to the current process
Link to this section Types
Link to this type
config()
config() :: [queue: Hare.Context.Action.DeclareQueue.config, routing_keys: [String.t], binds: [Keyword.t]]
Link to this section Functions
Link to this function
start_link(mod, conn, config, initial, opts \\ [])
start_link(module, connection, config, initial :: term, options) :: GenServer.on_start
Start a Freddy.Notifications.Listener
process linked to the current process.
Arguments:
mod
- the module that defines the server callbacks (like GenServer)connection
- the pid of aHare.Core.Conn
processconfig
- the configuration of the listenerinitial
- the value that will be given toinit/1
opts
- the GenServer options
Link to this function
stop(consumer)
Link to this function
stop(consumer, reason)