This client is based in the functionality of kafkajs for NodeJS. In the moment of implement the port, this library show some issues and not clear API about how the connection handshake and events are managed by the library, for this reason we decide to include an admin client in all the cases, even when we only want to stablish a consumer or producer.

Hierarchy (View Summary)

Constructors

Properties

Accessors

Methods

Constructors

  • Creates an instance of KafkaProducer

    Parameters

    • clientOptions: KafkaConfig

      Kafka client configuration options

    • OptionalproducerOptions: ProducerConfig

      Kafka producer configuration options

    • Optionalinterval: number

      Period of health check interval

    Returns Producer

Properties

options: KafkaConfig

Kafka Broker configuration options

Accessors

  • get client(): Producer
  • Return the producer of this class instance

    Returns Producer

  • get state(): boolean
  • Overall client state

    Returns boolean

Methods

  • Emitted when admin client can collect the desired information

    Parameters

    • event: "healthy"
    • listener: () => void

    Returns this

  • Emitted when admin client can not collect the desired information

    Parameters

    • event: "unhealthy"
    • listener: (crash: Crash) => void

    Returns this

  • Emitted every time that admin client get metadata from brokers

    Parameters

    Returns this

  • Emitted when admin client has some problem getting the metadata from brokers

    Parameters

    • event: "error"
    • listener: (crash: Crash) => void

    Returns this

  • Perform the connection of the instance to the system

    Returns Promise<void>

  • Perform the disconnection of the instance from the system

    Returns Promise<void>