A resource is extended component that represent the access to an external/internal resource, besides the error handling and identity, it has a start, stop and close methods to manage the resource lifecycle. It also has a checks property to define the checks that will be performed over the resource to achieve the resulted status. The most typical example of a resource are the Provider that allow to access to external databases, message brokers, etc.

Hierarchy

  • EventEmitter
    • ConsumerMap

Implements

Constructors

  • Create a new instance of the consumer map

    Parameters

    • name: string

      name of the producer

    • agingInterval: number

      agingInterval to update the consumer map

    • maxAge: number

      Max allowed age in in milliseconds for a table entry

    Returns ConsumerMap

Properties

componentId: string = ...

Component identification

name: string

name of the producer

Accessors

  • get status(): "pass" | "fail" | "warn"
  • Overall component status

    Returns "pass" | "fail" | "warn"

Methods

  • Clean the nodes map

    Returns void

  • Fake close method used to implement the Resource interface

    Returns Promise<void>

  • Return the consumers identifiers that has the indicated action/target pair

    Parameters

    • action: string

      action to search

    • target: string

      target requested

    Returns string[]

  • Returns the grouped features of all the consumer in the map

    Returns { pairs: ActionTargetPairs; profiles: string[] }

  • Emitted when a producer's operation has some problem

    Parameters

    • event: "error"
    • listener: (error: Crash | Error) => void

    Returns this

  • Emitted on every state change

    Parameters

    • event: "status"
    • listener: (status: "pass" | "fail" | "warn") => void

    Returns this

  • Emitted when new nodes are included included map

    Parameters

    • event: "new"
    • listener: (nodes: string[]) => void

    Returns this

  • Emitted when some nodes has been aged

    Parameters

    • event: "aged"
    • listener: (nodes: string[]) => void

    Returns this

  • Emitted when nodes are updated

    Parameters

    • event: "update"
    • listener: (nodes: string[]) => void

    Returns this

  • Emitted when the consumer has been updated

    Parameters

    • event: "updated"
    • listener: (nodes: string[]) => void

    Returns this

  • Fake start method used to implement the Resource interface

    Returns Promise<void>

  • Fake stop method used to implement the Resource interface

    Returns Promise<void>

  • Perform the update of the health map

    Parameters

    Returns void