@nestjs/microservices
Version:
Nest - modern, fast, powerful node.js web framework (@microservices)
46 lines (45 loc) • 863 B
JavaScript
import { BaseRpcContext } from './base-rpc.context.js';
/**
* @publicApi
*/
export class KafkaContext extends BaseRpcContext {
constructor(args) {
super(args);
}
/**
* Returns the reference to the original message.
*/
getMessage() {
return this.args[0];
}
/**
* Returns the partition.
*/
getPartition() {
return this.args[1];
}
/**
* Returns the name of the topic.
*/
getTopic() {
return this.args[2];
}
/**
* Returns the Kafka consumer reference.
*/
getConsumer() {
return this.args[3];
}
/**
* Returns the Kafka heartbeat callback.
*/
getHeartbeat() {
return this.args[4];
}
/**
* Returns the Kafka producer reference,
*/
getProducer() {
return this.args[5];
}
}