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 process
  • min_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.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

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.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
open(String? correlationId) Future
Opens the component.
shutdown() → void
Crashes the process using the configured crash mode.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited