agala v1.0.3 Agala.Router.Direct

Direct router creates single handler process and pass all incoming messages to it. It’s the simplest case. It also supervises handler process: if it falls - router will ensure to restart it before passing new incomming messages.

To use this router, put in your configuration:

# config.exs
router: Agala.Router.Direct

or don’t put anything, because this router goes by default.

Summary

Functions

This function initialises Supervisor tree, and is callback implementation for Supervisor.init/1 function

This function routes the message to defined Agala.Handler implementor

Types

message()
message() :: Agala.Model.Message.t

Functions

init(arg)

This function initialises Supervisor tree, and is callback implementation for Supervisor.init/1 function.

Unlikely you need to call this function manualy.

route(message)
route(message) :: :ok

This function routes the message to defined Agala.Handler implementor.

message/0 is an instance of single message, which can be used to define, what handler should be used in this direct case of routing. In this module, Agala.Model.Message.t/0 is simply passed to the handler

start_link()