Beekeeper::WorkerPool - Manage worker pools
Version 0.01
$ bkpr --pool-id MyPool start Starting pool of MyApp workers: beekeeper-MyPool. $ bkpr --pool-id MyPool stop Stopping pool of MyApp workers: beekeeper-MyPool. $ bkpr --help Usage: bkpr [options] {start|stop|restart|reload|check} --foreground Run in foreground (do not daemonize) --pool-id str Worker pool name (mandatory) --user str Run as specified user --group str Run as specified group --config-dir str Path to directory containing config files --debug Turn on workers debug flag --help Shows this message
This module contains the core of the command line tool bkpr which is used to manage worker pools: it start, stop and monitor pools of persistent Beekeeper::Worker processes which receive RPC requests from message bus.
bkpr
Beekeeper::Worker
When started it daemonize itself (unless --foreground option is passed) and fork all worker processes, then monitor those forked processes and immediately respawn defunct ones.
--foreground
Workers pools are defined into a file named pool.config.json, which is searched for into ENV BEEKEEPER_CONFIG_DIR, ~/.config/beekeeper and /etc/beekeeper. The file is in relaxed JSON format (so it allows comments and trailing commas).
pool.config.json
BEEKEEPER_CONFIG_DIR
~/.config/beekeeper
/etc/beekeeper
All worker pools running on the host must be declared into the file, specifying which logical bus should be used and which services it will run.
Each entry define a worker pool. Required parameters are:
pool-id An arbitrary identifier for the worker pool.
pool-id
bus-id An identifier of logical bus used by worker processes.
bus-id
workers A map of worker classes to (arbitrary) config hashes.
workers
The following example defines "MyApp" as a pool of 2 MyApp::Worker processes:
MyApp::Worker
[{ "pool-id" : "MyApp", "bus-id" : "backend", "workers" : { "MyApp::Worker" : { "workers_count" : 2 }, }, }]
All logical buses used by your application are defined into a file named bus.config.json and specify the conection parameters to the STOMP brokers that will service them.
bus.config.json
Each entry define a logical bus. Required parameters are:
bus-id arbitrary identifier of logical bus.
host hostname or IP address of the STOMP broker.
host
user username used to connect to the STOMP broker.
user
pass password used to connect to the STOMP broker.
pass
vhost virtual host of STOMP broker (may be omitted).
vhost
The following example defines the logical bus "backend":
[{ "bus-id" : "backend", "host" : "10.0.0.1", "user" : "username", "pass" : "password", "vhost" : "/backend", }]
José Micó, jose.mico@gmail.com
jose.mico@gmail.com
Copyright 2015 José Micó.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language itself.
This software is distributed in the hope that it will be useful, but it is provided “as is” and without any express or implied warranties. For details, see the full text of the license in the file LICENSE.
To install Beekeeper, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Beekeeper
CPAN shell
perl -MCPAN -e shell install Beekeeper
For more information on module installation, please visit the detailed CPAN module installation guide.