wpool_process_callbacks behaviour (worker_pool v7.0.0)

View Source

Summary

Types

Event being reported.

Callback state. Basically, the module that handles the callbacks.

Callbacks

Callback handler initialization.

Callback for new worker creation.

Callback for worker termination.

Functions

Sends a notification to all registered callback modules.

Types

event()

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

Event being reported.

state()

-nominal state() :: module().

Callback state. Basically, the module that handles the callbacks.

Callbacks

handle_init_start/1

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

Callback handler initialization.

handle_worker_creation/1

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

Callback for new worker creation.

handle_worker_death/2

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

Callback for worker termination.

Functions

add_callback_module(EventManager, Module)

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

Adds a callback module.

notify/3

-spec notify(event(), undefined | atom(), [term()]) -> ok.

Sends a notification to all registered callback modules.

remove_callback_module(EventManager, Module)

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

Removes a callback module.