evoq_aggregate_registry (evoq v1.14.1)

View Source

pg-based registry for aggregate processes.

Uses OTP pg module for process registration and lookup. Aggregates register with a group key of {aggregate, AggregateId}.

Summary

Functions

Get an existing aggregate or start a new one (uses env store_id).

Get an existing aggregate or start a new one with explicit store_id.

Lookup an aggregate by ID.

Register an aggregate process.

Start the aggregate registry.

Unregister an aggregate process.

Functions

get_or_start(AggregateModule, AggregateId)

This function is deprecated. Use get_or_start/3 with explicit store_id instead..
-spec get_or_start(atom(), binary()) -> {ok, pid()} | {error, term()}.

Get an existing aggregate or start a new one (uses env store_id).

get_or_start(AggregateModule, AggregateId, StoreId)

-spec get_or_start(atom(), binary(), atom()) -> {ok, pid()} | {error, term()}.

Get an existing aggregate or start a new one with explicit store_id.

lookup(AggregateId)

-spec lookup(binary()) -> {ok, pid()} | {error, not_found}.

Lookup an aggregate by ID.

register(AggregateId, Pid)

-spec register(binary(), pid()) -> ok.

Register an aggregate process.

start_link()

-spec start_link() -> {ok, pid()} | {error, term()}.

Start the aggregate registry.

unregister(AggregateId)

-spec unregister(binary()) -> ok.

Unregister an aggregate process.