Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LiftbridgeMetadata

Liftbridge stream & partition metadata.

Includes useful methods to fetch/refresh Liftbridge metadata and convert them into usable JSON objects.

Hierarchy

  • LiftbridgeMetadata

Index

Constructors

constructor

  • new LiftbridgeMetadata(client: APIClient, metadataResponse: FetchMetadataResponse): LiftbridgeMetadata
  • Metadata class.

    Holds all metadaata of brokers, streams & partitions.

    Parameters

    • client: APIClient

      Liftbridge client instance.

    • metadataResponse: FetchMetadataResponse

      MetadataResponse gRPC object.

    Returns LiftbridgeMetadata

Methods

get

getAddress

  • getAddress(stream: string, partition: number): string
  • Returns the broker address for the given stream partition.

    Parameters

    • stream: string

      Stream.

    • partition: number

      Stream partition.

    Returns string

    Broker address.

getPartitionsCountForSubject

  • getPartitionsCountForSubject(subject: string): Promise<number>
  • Returns a map containing stream names and the number of partitions for the stream. This does not match on wildcard subjects, e.g. "foo.*".

    Parameters

    • subject: string

      Subject to fetch partitions count for.

    Returns Promise<number>

    total partitions for the subject.

hasSubjectMetadata

  • hasSubjectMetadata(subject: string): boolean
  • Indicates if the Metadata has info for at least one stream with the given subject.

    Parameters

    • subject: string

      Subject to check metadata for.

    Returns boolean

    true if metadata was found for subject, or false otherwise.

update

  • Fetches the latest cluster metadata, including stream and broker information.

    Returns Promise<IMetadata>

    Metadata.