resolveAggregateIdAndOwner

fun resolveAggregateIdAndOwner(ownerIsAggregateId: Boolean, ownerId: String?, aggregateId: String?, generateAggregateId: () -> String): Pair<String, String?>

The aggregate ID and owner of a command to an aggregate whose owner may be its ID.

When ownerIsAggregateId, a non-blank ownerId is also the aggregate ID; otherwise the aggregate ID is the first of aggregateId and the generated one, and a blank owner becomes that ID. For any other aggregate the two are independent.

Return

the aggregate ID and the owner (null when no source gave one).

Parameters

ownerIsAggregateId

whether the aggregate's owner is its ID (OwnerPolicy.AGGREGATE_ID on an HTTP route).

ownerId

the resolved owner, see resolve with IdentityFact.OWNER_ID.

aggregateId

the resolved aggregate ID, see resolve with IdentityFact.AGGREGATE_ID.

generateAggregateId

generates an aggregate ID when no source gave one.