commanded v0.12.0 Commanded.ProcessManagers.ProcessManager behaviour
Behaviour to define a process manager
Summary
Functions
Macro as a convenience for defining a process manager
Callbacks
Mutate the process manager’s state by applying the domain event
Process manager instance handles the domain event, returning commands to dispatch
Is the process manager interested in the given command?
Types
Functions
Macro as a convenience for defining a process manager
defmodule ExampleProcessManager do
use Commanded.ProcessManagers.ProcessManager,
name: "example_process_manager",
router: BankRouter
def interested?(%AnEvent{...}) do
# ...
end
def handle(%ExampleProcessManager{...}, %AnEvent{...}) do
# ...
end
def apply(%ExampleProcessManager{...}, %AnEvent{...}) do
# ...
end
end
# start process manager (or configure as a worker inside a supervisor) {:ok, process_manager} = ExampleProcessManager.start_link()
Callbacks
Mutate the process manager’s state by applying the domain event
Process manager instance handles the domain event, returning commands to dispatch
interested?(domain_event)
interested?(domain_event) :: {:start, process_uuid} | {:continue, process_uuid} | {:stop, process_uuid} | false
Is the process manager interested in the given command?