ProcessContainer class
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
See Container
Example
var container = new ProcessContainer();
container.addFactory(MyComponentFactory());
container.run(process.args);
Constructors
- ProcessContainer([String? name, String? description])
- Creates a new instance of the container.
Properties
- config ↔ ContainerConfig?
-
getter/setter pairinherited
- configPath ↔ String
-
getter/setter pair
- factories ↔ DefaultContainerFactory
-
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- info ↔ ContextInfo?
-
getter/setter pairinherited
- logger ↔ ILogger
-
getter/setter pairinherited
- references ↔ ContainerReferences?
-
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addFactory(
IFactory factory) → void -
Adds a factory to the container. The factory is used to create components
added to the container by their locators (descriptors).
inherited
-
close(
String? correlationId) → Future -
Closes component and frees used resources.
inherited
-
configure(
ConfigParams config) → void -
Configures component by passing configuration parameters.
inherited
-
isOpen(
) → bool -
Checks if the component is opened.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
open(
String? correlationId) → Future -
Opens the component.
inherited
-
readConfigFromFile(
String? correlationId, String path, ConfigParams parameters) → Future -
Reads container configuration from JSON or YAML file
and parameterizes it with given values.
inherited
-
run(
List< String> args) → void - Runs the container by instantiating and running components inside the container.
-
setReferences(
IReferences references) → void -
Sets references to dependent components.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
unsetReferences(
) → void -
Unsets (clears) previously set references to dependent components.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited