commanded v0.10.0 Commanded.Commands.Handler behaviour

Summary

Callbacks

Apply the given command to the event-sourced aggregate root

Types

aggregate()
aggregate() :: struct
command()
command() :: struct
domain_events()
domain_events() :: [struct]
reason()
reason() :: term

Callbacks

handle(aggregate, command)
handle(aggregate, command) ::
  domain_events |
  nil |
  {:error, reason}

Apply the given command to the event-sourced aggregate root.

You must return a list containing the pending events, or nil / [] when no events produced.

You should return {:error, reason} on failure.