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
Models
EntityAddress
Added in v4.0.0
Source
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;
}
Constructs an
EntityAddressfrom 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
ShardIdassigned by the entity's shard group.Details
The returned
EntityAddressstores the suppliedshardId,entityType, andentityId. Equality and hashing include all three fields.Gotchas
makedoes not choose the shard for an entity. Use the same shard group logic as the entity definition; a differentshardIdmakes a different address even when the entity type and entity id match.See
EntityAddressfor the equality, hashing, and string formatting behavior of constructed addressesShardIdfor the shard identifier included in the address