TaskBunny v0.0.1-dev.6 TaskBunny.Worker

A GenServer that listens a queue and consumes messages.

Summary

Functions

Called when job was done. Acknowledge to RabbitMQ

Initialises GenServer. Send a request for RabbitMQ connection

Starts a worker given a worker’s state

Stops consuming messages from queue. Note this doesn’t terminate the process and the jobs currently running will continue so

Closes the AMQP Channel, when the worker exit is captured

Types

t()
t() :: %TaskBunny.Worker{channel: AMQP.Channel.t | nil, concurrency: integer, consumer_tag: String.t | nil, host: atom, job: atom, job_stats: %{failed: integer, succeeded: integer, rejected: integer}, runners: integer}

Functions

handle_info(msg, state)
handle_info(any, t) ::
  {:noreply, t} |
  {:stop, reason :: term, t}

Called when job was done. Acknowledge to RabbitMQ.

init(args)
init(t) :: {:ok, t} | {:stop, :connection_not_ready}

Initialises GenServer. Send a request for RabbitMQ connection

start_link(arg1)
start_link({atom, integer}) :: GenServer.on_start
start_link({atom, atom, integer}) :: GenServer.on_start
start_link(t) :: GenServer.on_start

Starts a worker given a worker’s state

stop_consumer(pid)
stop_consumer(pid) :: :ok

Stops consuming messages from queue. Note this doesn’t terminate the process and the jobs currently running will continue so.

terminate(reason, state)
terminate(any, TaskBunny.Worker.t) :: :normal

Closes the AMQP Channel, when the worker exit is captured.