commanded v0.10.0 Commanded.Aggregates.Aggregate

Process to provide access to a single event sourced aggregate root.

Allows execution of commands against an aggregate and handles persistence of events to the event store.

Summary

Functions

Access the aggregate’s state

Access the aggregate’s version

Execute the given command against the aggregate, optionally providing a timeout.

  • timeout is an integer greater than zero which specifies how many milliseconds to wait for a reply, or the atom :infinity to wait indefinitely. The default value is 5000

Execute the given command, using the provided handler, against the current aggregate state

Load any existing events for the aggregate from storage and repopulate the state using those events

Functions

aggregate_state(aggregate_uuid)

Access the aggregate’s state

aggregate_state(aggregate_uuid, timeout)
aggregate_version(aggregate_uuid)

Access the aggregate’s version

execute(aggregate_uuid, command, handler, function \\ :execute, timeout \\ 5000)

Execute the given command against the aggregate, optionally providing a timeout.

  • timeout is an integer greater than zero which specifies how many milliseconds to wait for a reply, or the atom :infinity to wait indefinitely. The default value is 5000.

Returns :ok on success, or {:error, reason} on failure

handle_call(msg, from, state)

Execute the given command, using the provided handler, against the current aggregate state

handle_cast(msg, state)

Load any existing events for the aggregate from storage and repopulate the state using those events

start_link(aggregate_module, aggregate_uuid)