bothy-sdk
    Preparing search index...

    Class PollingSource

    Events by REST polling (pollAgentEvents), acknowledged with ackAgentEvents.

    It polls again at once after a non-empty page and waits sdk.poll_interval after an empty one; it sends the agent heartbeat with sendHeartbeat every HeartbeatAck.interval_ms (the first at once, sdk.poll_interval until an answer names the interval). A failed poll waits with full jitter between zero and min(sync.reconnect_backoff_cap, sync.reconnect_backoff_base * 2^n); 401 and 403 stop it for good.

    Implements

    Index

    Constructors

    Properties

    client: ApiClient

    The REST client.

    clock: Clock

    The time source.

    closeReason: CloseReason | undefined

    Why the source stopped, once it has.

    consumer: string

    The consumer name.

    settings: SdkSettings

    The SDK settings.

    window: AckWindow = ...

    The acknowledgement window.

    Methods

    • Polls until PollingSource.close is called.

      Returns AsyncGenerator<Delivery, void, undefined>

      The deliveries.

    • Calls ackAgentEvents; a failure is logged, the next acknowledgement covers it.

      Parameters

      • seq: number

        The highest settled seq.

      Returns Promise<void>

      A promise that resolves after the call, also when it failed.

    • Passes on a cursor; it never settles an open delivered event.

      Parameters

      • seq: number

        The cursor.

      Returns Promise<void>

      A promise that resolves after a needed acknowledgement.

    • Calls answerAutocomplete.

      Parameters

      • requestId: string

        The request.

      • choices: readonly {}[]

        The choices.

      Returns Promise<void>

      A promise that resolves after the answer.

      ProblemError or TransportError when the call fails.

    • Stops polling after the current request.

      Returns Promise<void>

      A resolved promise.

    • Marks seq settled and calls ackAgentEvents when the acknowledgement point moves.

      Parameters

      • seq: number

        The settled seq.

      Returns Promise<void>

      A promise that resolves after a needed acknowledgement.