Options
All
  • Public
  • Public/Protected
  • All
Menu

Type returned when a subscribe call resolved. Provides methods to manage the subscription.

Hierarchy

  • Subscription

Index

Properties

sid

sid: number

Methods

cancelTimeout

  • cancelTimeout(): void
  • Cancels a timeout associated with the subscription

    Returns void

drain

  • drain(): Promise<any>
  • Draining a subscription is similar to unsubscribe but inbound pending messages are not discarded. When the last in-flight message is processed, the subscription handler is removed.

    see

    unsubscribe

    Returns Promise<any>

    a Promise that resolves when the draining a subscription completes

getMax

  • getMax(): number
  • Returns the number of messages expected by the subscription. If 0, the subscription was not found or was auto-cancelled. If -1, the subscription didn't specify a count for expected messages.

    Returns number

getReceived

  • getReceived(): number
  • Returns the number of messages received by the subscription.

    Returns number

hasTimeout

  • hasTimeout(): boolean
  • Returns true if the subscription has an associated timeout.

    Returns boolean

isCancelled

  • isCancelled(): boolean
  • Returns boolean

    true if the subscription is not found.

isDraining

  • isDraining(): boolean
  • see

    drain

    Returns boolean

    true if the subscription is draining.

setTimeout

  • setTimeout(millis: number): boolean
  • Sets a timeout on a subscription. The timeout will fire by calling the subscription's callback with an error argument if the expected number of messages (specified via max) has not been received by the subscription before the timer expires. If max is not specified, the subscription times out if no messages are received within the timeout specified.

    Returns true if the subscription was found and the timeout was registered.

    Parameters

    • millis: number

    Returns boolean

unsubscribe

  • unsubscribe(max?: undefined | number): void
  • Cancels the subscription after the specified number of messages has been received. If max is not specified, the subscription cancels immediately. A cancelled subscription will not process messages that are inbound but not yet handled.

    see

    drain

    Parameters

    • Optional max: undefined | number

    Returns void

Legend

  • Property
  • Method
  • Property
  • Inherited method

Generated using TypeDoc