EntityAddress
The EntityAddress module defines the value used to locate an entity within
a cluster. An address combines the entity type, entity id, and shard id so
messages, persisted envelopes, workflow executions, and entity managers can
agree on the same routing target.
Constructors
Constructs an EntityAddress from a shard ID, entity type, and entity ID.
When to use
Use to create the routing target for a known entity type and entity id after
resolving that id to the ShardId assigned by the entity's shard group.
Details
The returned EntityAddress stores the supplied shardId, entityType, and
entityId. Equality and hashing include all three fields.
Gotchas
make does not choose the shard for an entity. Use the same shard group
logic as the entity definition; a different shardId makes a different
address even when the entity type and entity id match.
See
- EntityAddress for the equality, hashing, and string formatting behavior of constructed addresses
- ShardId for the shard identifier included in the address
Signature
declare function make(options: { readonly entityId: string & Brand<"~effect/cluster/EntityId">; readonly entityType: string & Brand<"~effect/cluster/EntityType">; readonly shardId: ShardId;}): EntityAddressModels
EntityAddress
Represents the unique address of an entity within the cluster.
Signature
declare class EntityAddress extends { readonly entityId: string & Brand<"~effect/cluster/EntityId">; readonly entityType: string & Brand<"~effect/cluster/EntityType">; readonly shardId: ShardId;} { constructor(...args: [props: { readonly entityId: string & Brand<"~effect/cluster/EntityId">; readonly entityType: string & Brand<"~effect/cluster/EntityType">; readonly shardId: ShardId; }, options?: MakeOptions]); readonly "~effect/cluster/EntityAddress": "~effect/cluster/EntityAddress"; "~effect/interfaces/Equal"(that: EntityAddress): boolean; "~effect/interfaces/Hash"(): number; toString(): string;}