CosIdAggregateIdGenerator

class CosIdAggregateIdGenerator(runtime: CosIdRuntime, val fallback: String = CosIdProperties().aggregateGenerator) : AggregateIdGenerator, AggregateIdGeneratorSource

The aggregate ids of CosId (as 9.x CosIdAggregateIdGeneratorFactory). Wow builds no generator: CosId's configuration decides which exist, and an aggregate type's generator is found by name, in this order:

  1. wow.aggregates.[<context>.<aggregate>].id-generator, which names any of CosId's generators: the host finds it through this AggregateIdGeneratorSource (find) and does not start when CosId has none of that name;

  2. else the generator named after the aggregate's qualified name, <context>.<aggregate> (configured as cosid.generators."[<context>.<aggregate>]"), which gives a type a sequence space or a layout of its own;

  3. else CosId's generator fallback, wow.cosid.aggregate-generator (default by default).

Each type's generator is resolved once, at its first id, and logged at INFO. A CosId id is unique within its namespace, by default the service's; an aggregate id needs no more, since only the context that owns an aggregate type creates its aggregates. The node's own ids, which other services' requests meet in one context's idempotency key, stay Wow's UUIDv7: this module does not replace them.

Throws

naming wow.cosid.aggregate-generator when runtime has no generator fallback.

Constructors

Link copied to clipboard
constructor(runtime: CosIdRuntime, fallback: String = CosIdProperties().aggregateGenerator)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Functions

Link copied to clipboard
open override fun find(name: String): AggregateIdGenerator?
Link copied to clipboard
open override fun next(type: AggregateType): String
Link copied to clipboard
open override fun toString(): String