prorm API Reference
    Preparing search index...

    Class RedpandaStore

    RedpandaStore wraps a kafkajs client (Redpanda is Kafka-protocol compatible) and exposes the core streaming operations: producing messages, topic administration, and consumer subscriptions.

    Implements

    Index
    name: "redpanda" = 'redpanda'

    The name of the store (e.g. 'mongodb', 'redis', 'dynamodb')

    library: "kafkajs" = 'kafkajs'

    The client library being used

    • Produce one or more messages to topic. Returns kafkajs's record metadata (per-partition base offsets).

      Parameters

      • topic: string
      • messages: RedpandaMessage[]

      Returns Promise<any>

    • Create topic via a short-lived admin connection. Returns kafkajs's boolean indicating whether the topic was newly created (false if it already existed).

      Parameters

      • topic: string
      • opts: CreateTopicOptions = {}

      Returns Promise<boolean>

    • List all topic names known to the cluster via a short-lived admin connection.

      Returns Promise<string[]>

    • Subscribe a new consumer to topics and invoke handler for each message (kafkajs's eachMessage payload: { topic, partition, message }). The consumer joins the group options.groupId (a generated id is used if omitted) and is tracked so disconnect() stops it. Returns the created kafkajs consumer.

      Parameters

      • topics: string | string[]
      • handler: (payload: any) => void | Promise<void>
      • options: SubscribeOptions = {}

      Returns Promise<any>