Shutdown class
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 processmin_timeout
: minimum crash timeout in milliseconds (default: 5 mins)max_timeout
: maximum crash timeout in milliseconds (default: 15 minutes)
Example
var shutdown = Shutdown();
shutdown.configure(ConfigParams.fromTuples([
"mode": "exception"
]));
shutdown.shutdown(); // Result: Bang!!! the process crashes
Constructors
- Shutdown()
- Creates a new instance of the shutdown component.
Properties
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
close(
String correlationId) → Future - Closes component and frees used resources. [...]
-
configure(
ConfigParams config) → void - Configures component by passing configuration parameters. [...]
-
isOpen(
) → bool - Checks if the component is opened. [...]
-
open(
String correlationId) → Future - Opens the component. [...]
-
shutdown(
) → void - Crashes the process using the configured crash mode.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
inherited