pip_services3_container.ProcessContainer module

pip_services3_container.ProcessContainer

Process container implementation.

copyright

Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.

license

MIT, see LICENSE for more details.

class pip_services3_container.ProcessContainer.ProcessContainer(name: str = None, description: str = None)

Bases: pip_services3_container.Container.Container

Inversion of control (IoC) container that runs as a system process. It processes command line arguments and handles unhandled exceptions and Ctrl-C signal to gracefully shutdown the container.

### Command line arguments ###
  • –config -c path to JSON or YAML file with container configuration (default: “./config/config.yml”)

  • –param –params -p value(s) to parameterize the container configuration

  • –help -h prints the container usage help

Example:

container = ProcessContainer()
container.add_factory(MyComponentFactory())

container.run()
run()

Runs the container by instantiating and running components inside the container.

It reads the container configuration, creates, configures, references and opens components. On process exit it closes, unreferences and destroys components to gracefully shutdown.