Options
All
  • Public
  • Public/Protected
  • All
Menu

Overview

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.

Example Construction

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.

Hierarchy

  • TopicProducer

Index

Constructors

Properties

Methods

Constructors

Private constructor

  • Private constructor

    This method is not intended to be used directly. This is a helper method used by the Fluvio class to pass in a native object, along with top-level Fluvio client options, if any.

    Parameters

    • inner: TopicProducer

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

    Returns TopicProducer

Properties

Private inner

Methods

send

  • send(key: ProducerItem, value: ProducerItem): Promise<void>
  • send(key: ProducerItem, value: ProducerItem): Promise<void>
  • Parameters

    • key: ProducerItem
    • value: ProducerItem

    Returns Promise<void>

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

    Parameters

    • key: ProducerItem

      The Key data of the record to send

    • value: ProducerItem

      The Value data of the record to send

    Returns Promise<void>

sendAll

  • sendAll(records: KeyValue[]): Promise<void>
  • sendAll(elements: KeyValue[]): Promise<void>
  • Parameters

    Returns Promise<void>

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

    Parameters

    Returns Promise<void>

sendRecord

  • sendRecord(data: string, partition: number): Promise<void>
  • sendRecord(value: string, partition: number): 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>

Static create

  • 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

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Private property
  • Private method
  • Static method

Generated using TypeDoc