VoidCommand

Marks a command as a void command that doesn't require aggregate processing.

Void commands are sent to the command bus but don't need to be processed by aggregate roots. They are typically used for operations that don't require state changes or return values, such as logging, notifications, or external system integrations.

Void command characteristics:

  • Sent to command bus without requiring aggregate root processing

  • No return value or state update expected

  • Can be used for side effects and cross-cutting concerns

  • Must be mounted to aggregate roots via AggregateRoot.commands

Common use cases:

  • Recording user query operations for analytics

  • Sending notifications without changing domain state

  • Logging audit events

  • Triggering external system synchronizations

Example usage:

@VoidCommand
data class LogUserQuery(
val userId: String,
val query: String,
val timestamp: Instant = Instant.now()
)

@AggregateRoot(commands = [LogUserQuery::class])
class UserQueryLogger {
// No command handlers needed - just receives the command for logging
}

// Usage
commandBus.send(LogUserQuery(userId, searchQuery))
// Command is processed (logged) but no aggregate state is changed

See also

for mounting void commands to aggregates

for command mounting configuration