commanded v0.12.0 Commanded.Event.Handler behaviour
Summary
Functions
Macro as a convenience for defining an event handler
Callbacks
Event handler behaviour to handle a domain event and its metadata
Types
Functions
Macro as a convenience for defining an event handler
defmodule ExampleHandler do
use Commanded.Event.Handler, name: "example_handler"
def handle(%AnEvent{...}, _metadata) do
# ...
end
end
# start event handler process (or configure as a worker inside a supervisor) {:ok, handler} = ExampleHandler.start_link()
Callbacks
Event handler behaviour to handle a domain event and its metadata
Return :ok
on success, {:error, :already_seen_event}
to ack and skip the event, or {:error, reason}
on failure.