Kombu.Pidbox.Node (Kombu v0.1.0)

Copy Markdown View Source

Mailbox node routing and command dispatcher (kombu.pidbox.Node).

Summary

Functions

Creates a Consumer on this node's mailbox queue.

Executes the registered handler for method and sends reply if requested.

Dispatches incoming message if directed to this node.

Registers a command handler under name. fun receives (state, kwargs).

Starts consuming from the mailbox queue.

Sends reply back to caller via mailbox.

Types

t()

@type t() :: %Kombu.Pidbox.Node{
  channel: term(),
  handlers: term(),
  hostname: term(),
  mailbox: term(),
  state: term()
}

Functions

consumer(node, opts \\ [])

@spec consumer(t(), keyword()) :: Kombu.Consumer.t()

Creates a Consumer on this node's mailbox queue.

dispatch(node, method, arguments \\ %{}, reply_to \\ nil, ticket \\ nil, opts \\ [])

@spec dispatch(t(), String.t(), map(), map() | nil, String.t() | nil, keyword()) ::
  term()

Executes the registered handler for method and sends reply if requested.

handle_message(node, body, message \\ nil)

@spec handle_message(t(), map(), Kombu.Message.t() | nil) :: term()

Dispatches incoming message if directed to this node.

handler(node, name, fun)

@spec handler(t(), String.t() | atom(), (term(), map() -> term())) :: t()

Registers a command handler under name. fun receives (state, kwargs).

listen(node, opts \\ [])

@spec listen(t(), keyword()) :: Kombu.Consumer.t()

Starts consuming from the mailbox queue.

new(hostname, mailbox, opts \\ [])

@spec new(String.t(), Kombu.Pidbox.Mailbox.t(), keyword()) :: t()

reply(node, data, exchange, routing_key, ticket, opts \\ [])

@spec reply(t(), term(), String.t(), String.t(), String.t(), keyword()) :: :ok

Sends reply back to caller via mailbox.