CommandedAggregateless.Command.DefaultLifespan (commanded_aggregateless v1.0.0)

Copy Markdown

Stops the aggregate after a command, event or error.

It is always better to first prioritize reliability over performance. This lifespan module prevents Aggregate processes from hanging around indefinitely (the questionable default behaviour of Commanded) and stops them immediately after command execution. Snapshots can help avoid load times on aggregates with many events, and it is possible to define an alternative lifespan for certain commands/aggregates if perf-testing shows aggregate load time to be a bottleneck on frequently updated data.

Summary

Functions

Stops the aggregate after a command.

Stops the aggregate after an error.

Stops the aggregate after an event.

Functions

after_command(command)

Stops the aggregate after a command.

iex> OnePiece.Commanded.Aggregate.StatelessLifespan.after_command(%MyCommandOne{})
:stop

after_error(error)

Stops the aggregate after an error.

iex> OnePiece.Commanded.Aggregate.StatelessLifespan.after_error({:error, :something_happened})
:stop

after_event(event)

Stops the aggregate after an event.

iex> OnePiece.Commanded.Aggregate.StatelessLifespan.after_event(%DepositAccountOpened{})
:stop