wpool_process_callbacks behaviour (worker_pool v6.5.0)

View Source

Summary

Functions

Sends a notification to all registered callback modules.

Types

event/0

-type event() :: handle_init_start | handle_worker_creation | handle_worker_death.

state/0

-type state() :: module().

Callbacks

handle_init_start/1

(optional)
-callback handle_init_start(wpool:name()) -> any().

handle_worker_creation/1

(optional)
-callback handle_worker_creation(wpool:name()) -> any().

handle_worker_death/2

(optional)
-callback handle_worker_death(wpool:name(), term()) -> any().

Functions

add_callback_module(EventManager, Module)

-spec add_callback_module(wpool:name(), module()) -> ok | {error, any()}.

Adds a callback module.

notify(Event, _, Args)

-spec notify(event(), #{event_manager := any(), _ => _}, [any()]) -> ok.

Sends a notification to all registered callback modules.

remove_callback_module(EventManager, Module)

-spec remove_callback_module(wpool:name(), module()) -> ok | {error, any()}.

Removes a callback module.