tags:

views:

87

answers:

1

What is a design pattern in erlang in terms of gen_server to create a fixed number of worker processes and feed them with 'jobs' to perform some actions ? Each worker process talks with an external service which has connection limits. Number of 'jobs' considered to be unlimited. In C I'd do that by creating a pool of worker threads and an async. queue (with limited capacity) guarded by mutex to feed the pool with jobs from the submitter.

+1  A: 

Have the gen_server put a monitor on your worker processes, and when one dies (either job finished, or crash) spawn another one.

Zed
You could probably use a supervisor for this.
rvirding