aggregateId

fun NamedAggregate.aggregateId(id: String = generateId(), tenantId: String = TenantId.DEFAULT_TENANT_ID): DefaultAggregateId

Creates an AggregateId for this NamedAggregate with the specified parameters.

This extension function provides a convenient way to generate an aggregate ID for a named aggregate, automatically materializing the named aggregate if necessary.

Return

A new DefaultAggregateId instance.

Parameters

id

The unique identifier for the aggregate instance. Defaults to a generated ID using generateId.

tenantId

The tenant identifier. Defaults to TenantId.DEFAULT_TENANT_ID.

See also


fun AggregateMetadata<*, *>.aggregateId(id: String = generateId(), tenantId: String = staticTenantId ?: TenantId.DEFAULT_TENANT_ID): DefaultAggregateId

Creates an AggregateId for this AggregateMetadata with the specified parameters.

This extension function delegates to the named aggregate's aggregateId function, using the static tenant ID from the metadata if available, otherwise defaulting to the standard tenant ID.

Return

A new AggregateId instance created by the named aggregate.

Parameters

id

The unique identifier for the aggregate instance. Defaults to a generated ID using generateId.

tenantId

The tenant identifier. Defaults to the static tenant ID from this metadata or TenantId.DEFAULT_TENANT_ID.

See also