UNPKG

1 kBTypeScriptView Raw
1import { Consumer, KafkaMessage, Producer } from '../external/kafka.interface';
2import { BaseRpcContext } from './base-rpc.context';
3type KafkaContextArgs = [
4 message: KafkaMessage,
5 partition: number,
6 topic: string,
7 consumer: Consumer,
8 heartbeat: () => Promise<void>,
9 producer: Producer
10];
11/**
12 * @publicApi
13 */
14export declare class KafkaContext extends BaseRpcContext<KafkaContextArgs> {
15 constructor(args: KafkaContextArgs);
16 /**
17 * Returns the reference to the original message.
18 */
19 getMessage(): KafkaMessage;
20 /**
21 * Returns the partition.
22 */
23 getPartition(): number;
24 /**
25 * Returns the name of the topic.
26 */
27 getTopic(): string;
28 /**
29 * Returns the Kafka consumer reference.
30 */
31 getConsumer(): Consumer;
32 /**
33 * Returns the Kafka heartbeat callback.
34 */
35 getHeartbeat(): () => Promise<void>;
36 /**
37 * Returns the Kafka producer reference,
38 */
39 getProducer(): Producer;
40}
41export {};