DeleteAggregate
interface DeleteAggregate
Marker interface for commands that delete an aggregate instance.
Commands implementing this interface signal that the target aggregate should be permanently removed from the system. The deletion process typically involves:
Marking the aggregate as deleted (soft delete)
Publishing deletion events for downstream processing
Cleaning up related resources and references
Ensuring the operation is idempotent
See also
AggregateDeleted
event published when deletion completes
for undoing deletions
Example usage:
// Custom delete command with additional data
data class DeleteUserCommand(
val reason: String,
val deletedBy: String
) : DeleteAggregate
// Or use the default implementation
val deleteCommand = DefaultDeleteAggregateContent copied to clipboard