pip_services3_components.test.Shutdown module

class pip_services3_components.test.Shutdown.Shutdown

Bases: pip_services3_commons.config.IConfigurable.IConfigurable, pip_services3_commons.run.IOpenable.IOpenable

Random shutdown component that crashes the process using various methods.

The component is usually used for testing, but brave developers can try to use it in production to randomly crash microservices. It follows the concept of “Chaos Monkey” popularized by Netflix.

### Configuration parameters ###

  • mode: null - crash by NullPointer excepiton, zero - crash by dividing by zero, excetion = crash by unhandled exception, exit - exit the process

  • min_timeout: minimum crash timeout in milliseconds (default: 5 mins)

  • max_timeout: maximum crash timeout in milliseconds (default: 15 minutes)

Example:

close(correlation_id: Optional[str])

Closes component and frees used resources.

Parameters

correlation_id – (optional) transaction id to trace execution through call chain.

configure(config: pip_services3_commons.config.ConfigParams.ConfigParams)

Configures component by passing configuration parameters.

Parameters

config – configuration parameters to be set.

is_open()bool

Checks if the component is opened.

Returns

true if the component has been opened and false otherwise.

open(correlation_id: Optional[str])

Opens the component.

Parameters

correlation_id – (optional) transaction id to trace execution through call chain.

shutdown()

Crashes the process using the configured crash mode.