import Kafka, { IAdminClient, KafkaConsumer, Message } from '@confluentinc/kafka-javascript'; import BaseRunner from './base'; import { IRunner, KafkaConfiguration } from '../common'; import { Logger } from '../lib/logger'; import { Steveo } from '..'; declare class KafkaRunner extends BaseRunner implements IRunner { config: KafkaConfiguration; logger: Logger; consumer: KafkaConsumer; adminClient: IAdminClient; consumerReady: boolean; private debugEnabled; constructor(steveo: Steveo); /** * Required by IRunner interface, but in Kafka it processes a single message without the topic/partition params. * For Kafka, the message object already contains topic and partition information. * This is called internally by processBatch. Concurrency is controlled by Bluebird.map. */ receive(message: Message, _topic?: string, _partition?: number): Promise; private parseMessagePayload; /** * Get batch size based on configuration */ private getBatchSize; private processBatch; reconnect: () => Promise; /** * * @description It's a bound function to avoid binding when passing as callback to the checker function * Reference: https://github.com/Blizzard/node-rdkafka/issues/217#issuecomment-313582908 */ healthCheck: () => Promise; consumeCallback: (err: any, messages: any) => Promise; /** * Important to note that Kafka is different to SQS and Redis Runners * as with they are both polling consumers * no timeout behaviour, need to hook into the stream provided by node-rdkafka */ process(topics: Array): Promise; getTopicsWithTasks(topics: string[]): string[]; createQueue(topic: string): Promise; shutdown(): Promise; } export default KafkaRunner;