Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Shutdown

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

let shutdown = new Shutdown();
shutdown.configure(ConfigParams.fromTuples(
    "mode": "exception"
));
shutdown.shutdown();         // Result: Bang!!! the process crashes

Hierarchy

  • Shutdown

Implements

  • any
  • any

Index

Constructors

constructor

  • Creates a new instance of the shutdown component.

    Returns Shutdown

Methods

close

  • close(correlationId: string, callback: function): void
  • Closes component and frees used resources.

    Parameters

    • correlationId: string

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

    • callback: function

      callback function that receives error or null no errors occured.

        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns void

configure

  • configure(config: ConfigParams): void
  • Configures component by passing configuration parameters.

    Parameters

    • config: ConfigParams

      configuration parameters to be set.

    Returns void

isOpen

  • isOpen(): boolean
  • Checks if the component is opened.

    Returns boolean

    true if the component has been opened and false otherwise.

open

  • open(correlationId: string, callback: function): void
  • Opens the component.

    Parameters

    • correlationId: string

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

    • callback: function

      callback function that receives error or null no errors occured.

        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns void

shutdown

  • shutdown(): void
  • Crashes the process using the configured crash mode.

    Returns void

Generated using TypeDoc