prorm API Reference
    Preparing search index...

    Class PulsarStore

    PulsarStore wraps a pulsar-client Client and exposes Pulsar's core operations: producing messages, consumer subscriptions, and readers.

    Implements

    Index
    name: "pulsar" = 'pulsar'

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

    library: "pulsar-client" = 'pulsar-client'

    The client library being used

    • Produce message to topic. The producer for a topic is created on first use and cached, so repeated produce() calls to the same topic reuse it. message may be a UTF-8 string or a Buffer; it is serialized to raw bytes and sent as { data: Buffer }. Returns the producer's send result.

      Parameters

      • topic: string
      • message: PulsarMessage

      Returns Promise<any>

    • Subscribe a consumer to topic under subscription and invoke handler for every received message. Runs a background receive loop that calls consumer.receive(), passes each message to handler, then acknowledges it with consumer.acknowledge(msg). The loop stops on disconnect(). The consumer is tracked so disconnect() closes it. Returns the created consumer.

      Parameters

      • topic: string
      • subscription: string
      • handler: (msg: any) => void | Promise<void>
      • options: SubscribeOptions = {}

      Returns Promise<any>

    • Create a Pulsar reader over topic. Readers give non-destructive, position-controlled reads (no subscription/acks). The reader is tracked so disconnect() closes it. Returns the created reader.

      Parameters

      • topic: string
      • options: ReaderOptions = {}

      Returns Promise<any>