evoq_pm_router (evoq v1.14.1)

View Source

Routes events to process manager instances.

Correlates events with process manager instances based on the correlate/2 callback and routes them accordingly.

Correlation Flow

1. Event received 2. Find all PM modules interested in this event type 3. For each PM, call correlate/2 to determine process instance 4. Route to existing instance or start new one

Summary

Functions

Get a PM instance by event type and process ID.

Register a PM instance for an event type.

Register a process manager module.

Route an event to process manager instances.

Start the PM router.

Unregister a PM instance.

Unregister a process manager module.

Functions

get_instance(EventType, ProcessId)

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

Get a PM instance by event type and process ID.

register_instance(EventType, ProcessId, Pid)

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

Register a PM instance for an event type.

register_pm(PMModule)

-spec register_pm(atom()) -> ok.

Register a process manager module.

route_event(Event, Metadata)

-spec route_event(map(), map()) -> ok.

Route an event to process manager instances.

start_link()

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

Start the PM router.

unregister_instance(EventType, ProcessId)

-spec unregister_instance(binary(), binary()) -> ok.

Unregister a PM instance.

unregister_pm(PMModule)

-spec unregister_pm(atom()) -> ok.

Unregister a process manager module.