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.

interface ProducerAdapter {
    on(event: "error", listener: (error: Crash | Error) => void): this;
    on(
        event: "status",
        listener: (status: "pass" | "fail" | "warn") => void,
    ): this;
    publish(
        message: CommandMessage,
    ): Promise<void | ResponseMessage | ResponseMessage[]>;
    start(): Promise<void>;
    stop(): Promise<void>;
}

Hierarchy (View Summary)

Implemented by

Methods

  • Emitted when a adapter's operation has some error

    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

  • Connect the OpenC2 Adapter to the underlayer transport system

    Returns Promise<void>

  • Disconnect the OpenC2 Adapter to the underlayer transport system

    Returns Promise<void>