Class TopicProducer

Topic Producer

An interface for producing events to a particular topic

A TopicProducer allows you to send events to the specific topic it was initialized for. Once you have a TopicProducer, you can send events to the topic, choosing which partition each event should be delivered to.

Do not construct this manually, instead use the following method:

const fluvio = new Fluvio({ host, port })

await fluvio.connect();

const producer = await fluvio.topicProducer("topic-name")

This class constructor is used internally by the Fluvio client to provision a topic producer.

The inner object is a private object that is the native module created by the top-level Fluvio client.

This class is not intended to be constructed manually.

Methods

  • Returns Promise<void>

  • Returns Promise<void>

  • Parameters

    • key: ProducerItem
    • value: ProducerItem

    Returns Promise<void>

  • Sends a key-value event to this producer's topic

    Parameters

    • key: string | ArrayBuffer

      The Key data of the record to send

    • value: string | ArrayBuffer

      The Value data of the record to send

    Returns Promise<void>

  • Parameters

    Returns Promise<void>

  • Sends a list of key-value elements to this producer's topic

    Parameters

    Returns Promise<void>

  • Parameters

    • data: string
    • partition: number

    Returns Promise<void>

  • Sends an event to a specific partition within this producer's topic

    Parameters

    • value: string

      Buffered data to send to the Fluvio partition

    • partition: number

      The partition that this record will be sent to

    Returns Promise<void>

  • Factory method for creating a new topic Producer; This method is used by the Fluvio class. It is not meant to be called directly;

    Parameters

    • inner: TopicProducer

      The native node module created by await (new Fluvio().connect()).topicProducer()

    Returns TopicProducer