Commanded v0.15.0 Commanded.Aggregates.AggregateLifespan behaviour View Source

The Commanded.Aggregates.AggregateLifespan behaviour is used to control an aggregate lifespan.

By default an aggregate instance process will run indefinitely once started. You can control this by implementing the Commanded.Aggregates.AggregateLifespan behaviour in a module.

The after_command/1 function is called after each command executes. The returned timeout value is used to shutdown the aggregate process if no other messages are recevied.

Return :infinity to prevent the aggregate instance from shutting down.

Link to this section Summary

Callbacks

After specified timeout aggregate process will be stoped

Link to this section Types

Link to this type command() View Source
command() :: struct()
Link to this type timeout_or_action() View Source
timeout_or_action() :: timeout() | :infinity | :hibernate

Link to this section Callbacks

Link to this callback after_command(command) View Source
after_command(command()) :: timeout_or_action()

After specified timeout aggregate process will be stoped.

Timeout begins at start of processing a command.