Home

Awesome

Another Erlang OTP application for managing pools of workers

=====

Features:

Other erlang pools:

https://github.com/devinus/poolboy and https://github.com/inaka/worker_pool

Build

$ rebar3 compile

Tests

$ rebar3 ct    

Examples

%%simplepool:start_pool([Pool name], [Pool size], [Worker module], [Arg for the Init of the module]).
ok = simplepool:start_pool(pool3, 5, test_worker, [1,2,3], #{strategy => one_for_one, intensity => 1, period => 5}, undefined).
{5, Workers3, undefined} = simplepool:pool(pool3).
5 = tuple_size(Workers3).
RandWorker1 = simplepool:rand_worker(pool3).
0 = gen_server:call(RandWorker1, {mul, 2}).
simplepool:stop_pool(pool3),
not_found = simplepool:pool(pool3),
%%global workers are also possible
ok = simplepool:start_pool(global, pool4, 5, test_worker, [1,2,3], #{strategy => one_for_all, intensity => 1, period => 5}, test_controller).
RandWorker2 = simplepool:rand_worker(pool4).
0 = gen_server:call(RandWorker2, {mul, 2}).

It is also possible to specify pools in env of the app.src file.

See the tests for more examples. Example apps: https://github.com/brigadier/tara/ https://github.com/brigadier/geodata2/