Class EventQueue

Event queue class.

Consolidate event entries and then send them all in a single request at the next process tick. This greatly reduces number of API requests in case of batch requests, i.e. listing multiple entities in same GraphQL request.

Hierarchy

  • EventQueue

Constructors

Properties

_eventBus: EventBridge
_nextPromise?: Promise<void>
_nextReject?: ((reason?: any) => void)

Type declaration

    • (reason?: any): void
    • Parameters

      • Optional reason: any

      Returns void

_nextResolve?: ((value: void | PromiseLike<void>) => void)

Type declaration

    • (value: void | PromiseLike<void>): void
    • Parameters

      • value: void | PromiseLike<void>

      Returns void

_promise?: Promise<void>
_queue: PutEventsRequestEntry[] = []
_reject?: ((reason?: any) => void)

Type declaration

    • (reason?: any): void
    • Parameters

      • Optional reason: any

      Returns void

_resolve?: ((value: void | PromiseLike<void>) => void)

Type declaration

    • (value: void | PromiseLike<void>): void
    • Parameters

      • value: void | PromiseLike<void>

      Returns void

_runtimeConfig: RuntimeConfig
_state: EventQueueState = EventQueueState.idle

Methods

  • Private

    Puts queued events to AWS EventBridge.

    This method is a process.nextTick callback and should never be called directly.

    Returns void

  • Private

    Transitions to a queued state.

    Creates new Promise (or replaces it with the one which was already promised to someone), adds new process.nextTick handler and updates the internal state.

    Returns void

  • Adds new event to a queue.

    Returns

    • A Promise which is resolved when a given event is pushed to the message bus.

    Parameters

    • source: string

      AWS EventBridge event source.

    • eventDetailType: string

      AWS EventBridge event detail type.

    • eventData: object

      Event data.

    Returns undefined | Promise<void>

Generated using TypeDoc