ExActor.Starters
A mixin that provides start/2
and start_link/2
interface functions that can be used to start new instances of the gen_server.
Examples:
Actor.start # same as Actor.start(nil)
Actor.start(init_arg)
Actor.start(init_arg, gen_server_options)
Actor.start_link # same as Actor.start_link(nil)
Actor.start_link(init_arg)
Actor.start_link(init_arg, gen_server_options)
In gen_server_options
, you can include name: registered_name
to set the registered name of the server in runtime. Following patterns are allowed:
:some_alias
- registers locally{:local, :some_alias}
- same as above{:global, :some_alias}
- registers globally{:via, Module, :alias}
- uses Module for registration
All starter functions are overridable, and you can redefine them in your module. If you don't want these functions, you can exclude them, by providing starters: false
option. For example:
use ExActor.GenServer, starters: false