subscribex v0.10.0-rc.0 Subscribex.Broker

Defines a Broker.

The broker expects the :otp_app as an option. The :otp_app should point to an OTP application that has the broker configuration. For example, the broker:

defmodule Broker do
  use Subscribex.Broker, otp_app: :my_app
end

Could be configured with:

config :my_app, Broker,
  host: "localhost",
  username: "guest",
  password: "guest",
  port: 5672

URLs

Brokers by default support URLs. For example, the configuration above could be rewritten to:

config :my_app, Broker,
  url: "amqp://guest:guest@localhost:5672"

Summary

Types

callback_return :: term
channel :: %AMQP.Channel{conn: term, pid: term}
delivery_tag :: term
t :: module

Functions

apply_link(channel, atom)
channel(broker, link)
channel(broker, module, function, args)

Specs

channel(module, module, atom, [any]) :: any
close(broker, channel)
config(broker)

Specs

config(module) :: Keyword.t
config(broker, key)

Specs

config(module, atom) :: any
config!(broker, key)

Specs

config!(module, atom) :: any
publish(channel, exchange, routing_key, payload, options \\ [])

Specs

publish(channel, String.t, String.t, binary, keyword) ::
  :ok |
  :blocked |
  :closing
publish_sync(channel, exchange, routing_key, payload, options \\ [])

Specs

publish_sync(channel, String.t, String.t, binary, keyword) ::
  :ok |
  :blocked |
  :closing
rabbit_host(broker)
sanitize_host(host)

Specs

sanitize_host(String.t | Keyword.t) :: Keyword.t
sanitize_host(username, password, host, port)

Specs

sanitize_host(String.t, String.t, String.t | charlist, String.t | integer) :: Keyword.t
start_link(broker, count \\ 1)
subscriber_spec(subscriber)