The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Beekeeper::Config - Read configuration files

VERSION

Version 0.01

SYNOPSIS

DESCRIPTION

Beekeeper applications use two config files to define how clients, workers and brokers connect to each other.

These files are searched for in ENV BEEKEEPER_CONFIG_DIR, ~/.config/beekeeper and then /etc/beekeeper.

pool.config.json

This file defines all worker pools running on this host, specifying which logical bus should be used and which services it will run.

The file format is in relaxed JSON, which allows comments and trailings commas.

Each entry define a worker pool. Required parameters are:

pool-id: arbitrary identifier for the worker pool

bus-id: identifier of logical bus used by worker processes

workers: a map of worker classes to arbitrary config hashes

Example:

  [
      {
          "pool-id"     : "myapp",
          "bus-id"      : "backend",
          "description" : "pool of MyApp workers",
  
          "workers" : {
              "MyApp::Service::Foo::Worker" : { "workers_count" : 4 },
              "MyApp::Service::Bar::Worker" : { "workers_count" : 2 },
          },
      },
  ]

bus.config.json

This file defines all logical buses used by your application, specifying the conection parameters to the STOMP brokers that will service them.

For development purposes is handy to use a single broker to hold all logical buses and easily simulate a complex topology, but in production enviroments brokers should be isolated from each other.

The file format is in relaxed JSON, which allows comments and trailings commas.

Each entry define a logical bus. Accepted parameters are:

bus-id: unique identifier of the logical bus (required)

cluster: identifier of the cluster of logical buses that this bus belongs to (if any)

host: hostname or IP address of the broker (required)

port: port of the broker (default is 61613)

tls: if set to true enables the use of TLS on broker connection

user: username used to connect to the broker (required)

pass: password used to connect to the broker (required)

vhost: virtual host on broker (ignored by some brokers)

Example:

  [
      {
          "bus-id"  : "backend",
          "host"    : "localhost",
          "user"    : "backend",
          "pass"    : "def456",
          "vhost"   : "/back",
      },
      {
          "bus-id"  : "frontend",
          "host"    : "localhost",
          "user"    : "frontend",
          "pass"    : "def456",
          "vhost"   : "/front",
      },
  ]

METHODS

get_bus_config( bus_id => $id )

Reads and parse bus.config.json and returns the config of the requested bus.

get_pool_config( bus_id => $id )

Reads and parse pool.config.json and returns the config of the requested pool.

read_config_file( $filename )

Reads the given file and returns its content parsed as JSON.

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.