NAME
Beekeeper::WorkerPool - Manage worker pools
VERSION
Version 0.01
SYNOPSIS
$ 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
DESCRIPTION
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.
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.
CONFIGURATION
pool.config.json
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).
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.
bus-id
An identifier of logical bus used by worker processes.
workers
A map of worker classes to (arbitrary) config hashes.
The following example defines "MyApp" as a pool of 2 MyApp::Worker
processes:
[{
"pool-id" : "MyApp",
"bus-id" : "backend",
"workers" : {
"MyApp::Worker" : { "workers_count" : 2 },
},
}]
bus.config.json
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.
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.
user
username used to connect to the STOMP broker.
pass
password used to connect to the STOMP broker.
vhost
virtual host of STOMP broker (may be omitted).
The following example defines the logical bus "backend":
[{
"bus-id" : "backend",
"host" : "10.0.0.1",
"user" : "username",
"pass" : "password",
"vhost" : "/backend",
}]
AUTHOR
José Micó, jose.mico@gmail.com
COPYRIGHT AND LICENSE
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.