Packages
rambla
0.14.3
1.5.0
1.4.2
1.4.1
1.4.0
1.3.0
1.2.6
1.2.5
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.1
1.0.0
0.16.6
0.16.5
0.16.4
0.16.3
0.16.2
0.16.1
0.16.0
0.15.0
0.14.4
0.14.3
0.14.2
0.14.1
0.14.0
0.13.1
0.13.0
0.12.2
0.12.1
0.11.1
0.11.0
0.10.0
0.9.3
0.9.2
0.9.1
0.9.0
0.8.4
0.8.3
0.8.2
0.8.1
0.8.0
0.7.0
0.6.5
0.6.4
0.6.3
0.6.2
0.6.1
0.6.0
0.5.5
0.5.4
0.5.3
0.5.2
0.5.1
0.5.0
0.4.0
0.3.0
0.2.0
0.1.0
Easy publishing to many different targets. Supported back-ends: - Rabbit [Amqp](https://hexdocs.pm/amqp/) - Redis [Redix](https://hexdocs.pm/redix) - Http [:httpc](http://erlang.org/doc/man/httpc.html) - Smtp [:gen_smtp](https://hexdocs.pm/gen_smtp) - Slack [Envío](https://hexdocs.pm/envio)
Current section
Files
Jump to
Current section
Files
lib/rambla.ex
defmodule Rambla do
@moduledoc """
Interface for the message publishing through `Rambla`.
`Rambla` maintains connection pools with a dynamix supervisor.
It might be read from the config _or_ passed as a parameter in a call to
`Rambla.start_pools/1`. The latter expects a keyword list of pools to add,
each declared with the name of the worker _and_ the options with the following keys:
- `:type` the type of the worker; defaults to `:local`
- `:name` the name of the worker; defaults to the module name
- `:options` options to be passed to the worker initialization in `:poolboy`, like `[size: 5, max_overflow: 300]`
- `:params` arguments to be passed to the worker during initialization
In the static configuration (through `config/env.exs`,) pool options might be given
through `pool: keyword()` parameter.
"""
@doc """
Starts the pools configured in the `config.exs` / `releases.exs` file.
This call is equivalent to `start_pools(Application.get_env(:rambla, :pools))`.
"""
defdelegate start_pools(), to: Rambla.ConnectionPool
@doc "Starts the pools as specified by options (`map()` or `keyword()`)"
defdelegate start_pools(opts), to: Rambla.ConnectionPool
@doc """
Publishes the message to the target pool. The message structure depends on
the destination. For `RabbitMQ` is might be whatever, for `Smtp` it expects
to have `to:`, `subject:` and `body:` fields.
"""
defdelegate publish(target, message), to: Rambla.ConnectionPool
@doc """
Publishes the message to the target pool, allowing additional options to be set.
"""
defdelegate publish(target, message, opts), to: Rambla.ConnectionPool
@doc """
Publishes the message to the destination synchronously, avoiding the pool.
"""
defdelegate publish_synch(target, message), to: Rambla.ConnectionPool
@doc """
Publishes the message to the destination synchronously, avoiding the pool.
Unlike `publish_synch/2`, allows to specify additional options per request.
"""
defdelegate publish_synch(target, message, opts), to: Rambla.ConnectionPool
@doc """
Executes any arbitrary function in the context of one of workers in the
respective connection pool for the target.
The function would receive a pid of the connection process.
"""
defdelegate raw(target, f), to: Rambla.ConnectionPool
end