View Source FaktoryWorker (faktory_worker v1.9.8)
The FaktoryWorker
module provides everything required to setup workers for sending and fetching jobs.
It is expected that FaktoryWorker will be configured and started as part of a supervision tree. Multiple instances of
FaktoryWorker can be configured by providing the :name
option which must be unique.
This module can either be configured using all default options.
children = [
FaktoryWorker
]
Or by using the two element tuple format accepting a list of options as the second element.
children = [
{FaktoryWorker, [name: :faktory_test, ...]}
]
For a full list of configuration options see the Configuration documentation.
Summary
Functions
Attaches the default telemetry handler provided by FaktoryWorker.
Send a command to the Faktory server.
Types
@type command() :: FaktoryWorker.Protocol.protocol_command()
@type send_command_opt() :: {:faktory_name, module()} | {:timeout, pos_integer()}
Functions
@spec attach_default_telemetry_handler() :: :ok | {:error, :already_exists}
Attaches the default telemetry handler provided by FaktoryWorker.
This function attaches the default telemetry handler provided by FaktoryWorker that outputs log messages for each of the events emitted by FaktoryWorker.
For a full list of events see the Logging documentation.
@spec send_command(command(), [send_command_opt()]) :: FaktoryWorker.Connection.response() | {:error, :timeout}
Send a command to the Faktory server.
In most cases, FaktoryWorker
handles sending commands on your behalf.
However, there are some APIs (such as Enterprise Batches and Tracking)
where it's useful to send a command directly.
The full list of supported commands is available in
FaktoryWorker.Protocol.protocol_command()
. It is left to the caller to
verify that command arguments are valid.
Options
faktory_name
the Faktory instance to use (default: FaktoryWorker)timeout
how long to wait for a response, in ms (default: 5000)