Options
All
  • Public
  • Public/Protected
  • All
Menu

Class KafkaProducer<K, V>

Vert.x Kafka producer.

The {@link WriteStream#write} provides global control over writing a record.

Type parameters

  • K

  • V

Hierarchy

  • KafkaProducer

Implements

  • any

Index

Methods

abortTransaction

  • abortTransaction(): PromiseLike<void>
  • abortTransaction(handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): KafkaProducer<K, V>
  • Aborts the ongoing transaction. See abortTransaction

    Returns PromiseLike<void>

  • Aborts the ongoing transaction. See abortTransaction

    Parameters

    • handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns KafkaProducer<K, V>

beginTransaction

  • beginTransaction(): PromiseLike<void>
  • beginTransaction(handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): KafkaProducer<K, V>
  • Starts a new kafka transaction. See {@link KafkaProducer#beginTransaction}

    Returns PromiseLike<void>

  • Starts a new kafka transaction. See {@link KafkaProducer#beginTransaction}

    Parameters

    • handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns KafkaProducer<K, V>

close

  • close(): PromiseLike<void>
  • close(completionHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • close(timeout: number): PromiseLike<void>
  • close(timeout: number, completionHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Close the producer

    Returns PromiseLike<void>

  • Close the producer

    Parameters

    • completionHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

  • Close the producer

    Parameters

    • timeout: number

    Returns PromiseLike<void>

  • Close the producer

    Parameters

    • timeout: number
    • completionHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

commitTransaction

  • commitTransaction(): PromiseLike<void>
  • commitTransaction(handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): KafkaProducer<K, V>
  • Commits the ongoing transaction. See {@link KafkaProducer#commitTransaction}

    Returns PromiseLike<void>

  • Commits the ongoing transaction. See {@link KafkaProducer#commitTransaction}

    Parameters

    • handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns KafkaProducer<K, V>

drainHandler

  • drainHandler(handler: ((res: void) => void) | Handler<void> | null | undefined): KafkaProducer<K, V>
  • Parameters

    • handler: ((res: void) => void) | Handler<void> | null | undefined

    Returns KafkaProducer<K, V>

end

  • end(): PromiseLike<void>
  • end(arg0: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • end(data: KafkaProducerRecord<K, V>): PromiseLike<void>
  • end(data: KafkaProducerRecord<K, V>, handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Returns PromiseLike<void>

  • Parameters

    • arg0: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

  • Parameters

    Returns PromiseLike<void>

  • Parameters

    • data: KafkaProducerRecord<K, V>
    • handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

exceptionHandler

  • exceptionHandler(handler: ((res: Throwable) => void) | Handler<Throwable> | null | undefined): KafkaProducer<K, V>
  • Parameters

    • handler: ((res: Throwable) => void) | Handler<Throwable> | null | undefined

    Returns KafkaProducer<K, V>

flush

  • flush(): PromiseLike<void>
  • flush(completionHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): KafkaProducer<K, V>
  • Invoking this method makes all buffered records immediately available to write

    Returns PromiseLike<void>

  • Invoking this method makes all buffered records immediately available to write

    Parameters

    • completionHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns KafkaProducer<K, V>

initTransactions

  • initTransactions(): PromiseLike<void>
  • initTransactions(handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): KafkaProducer<K, V>
  • Initializes the underlying kafka transactional producer. See {@link KafkaProducer#initTransactions} ()}

    Returns PromiseLike<void>

  • Initializes the underlying kafka transactional producer. See {@link KafkaProducer#initTransactions} ()}

    Parameters

    • handler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns KafkaProducer<K, V>

partitionsFor

  • Get the partition metadata for the give topic.

    Parameters

    • topic: string

    Returns PromiseLike<PartitionInfo>

  • Get the partition metadata for the give topic.

    Parameters

    Returns KafkaProducer<K, V>

send

setWriteQueueMaxSize

  • Parameters

    • i: number

    Returns KafkaProducer<K, V>

write

  • Parameters

    Returns PromiseLike<void>

  • Parameters

    • arg0: KafkaProducerRecord<K, V>
    • arg1: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

writeQueueFull

  • writeQueueFull(): boolean
  • Returns boolean

Static create

  • create<K, V>(vertx: Vertx, config: {}): KafkaProducer<K, V>
  • create<K, V>(vertx: Vertx, config: {}, keyType: any, valueType: any): KafkaProducer<K, V>
  • Create a new KafkaProducer instance

    Type parameters

    • K

    • V

    Parameters

    • vertx: Vertx
    • config: {}
      • [key: string]: string

    Returns KafkaProducer<K, V>

  • Create a new KafkaProducer instance

    Type parameters

    • K

    • V

    Parameters

    • vertx: Vertx
    • config: {}
      • [key: string]: string
    • keyType: any
    • valueType: any

    Returns KafkaProducer<K, V>

Static createShared

  • Get or create a KafkaProducer instance which shares its stream with any other KafkaProducer created with the same name

    When close has been called for each shared producer the resources will be released. Calling end closes all shared producers.

    Type parameters

    • K

    • V

    Parameters

    • vertx: Vertx
    • name: string
    • config: {}
      • [key: string]: string

    Returns KafkaProducer<K, V>

  • Get or create a KafkaProducer instance which shares its stream with any other KafkaProducer created with the same name

    When close has been called for each shared producer the resources will be released. Calling end closes all shared producers.

    Type parameters

    • K

    • V

    Parameters

    Returns KafkaProducer<K, V>

  • Get or create a KafkaProducer instance which shares its stream with any other KafkaProducer created with the same name

    When close has been called for each shared producer the resources will be released. Calling end closes all shared producers.

    Type parameters

    • K

    • V

    Parameters

    • vertx: Vertx
    • name: string
    • config: {}
      • [key: string]: string
    • keyType: any
    • valueType: any

    Returns KafkaProducer<K, V>

  • Get or create a KafkaProducer instance which shares its stream with any other KafkaProducer created with the same name

    When close has been called for each shared producer the resources will be released. Calling end closes all shared producers.

    Type parameters

    • K

    • V

    Parameters

    Returns KafkaProducer<K, V>

Generated using TypeDoc