An event-driven automation framework for Elixir.
If available in Hex, the package can be installed
by adding auto_ex
to your list of dependencies in mix.exs
:
def deps do
[
{:auto_ex, "~> 0.1.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/auto_ex.
A signal is an event that triggers all actions linked to it.
alias AutoEx.Signal
{:ok, pid} = Signal.start_link()
Signal.run(pid)
An action is a stand alone function.
alias AutoEx.Action
action = Action.new(fn -> IO.puts "Performing action!" end)
Action.run(action)
When an action is added to a signal, it is run whenever the signal is.
alias AutoEx.{Signal, Action}
{:ok, signal} = Signal.start_link()
action = Action.new(fn -> IO.puts "Performing action!" end)
Signal.add_action(signal, action)
Singal.run(signal)
Advantages on Resource:
- crud semantics
- persistance
- Tests!
- Action retry
- Logging when signal is fired
- Logging when action is executed (successful/failure)
- persistance for resource
- documenting resource