@twt-494/nestjs-kafka 8.0.2 → 8.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/kafka.service.d.ts +7 -1
- package/dist/kafka.service.js +7 -1
- package/package.json +1 -1
package/dist/kafka.service.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { OnApplicationBootstrap } from '@nestjs/common';
|
|
2
2
|
import KafkaClient from './kafka-client';
|
|
3
|
+
import { RecordMetadata } from "kafkajs";
|
|
3
4
|
export declare class KafkaService implements OnApplicationBootstrap {
|
|
4
5
|
private readonly options;
|
|
5
6
|
private kafka;
|
|
6
7
|
constructor(options: any);
|
|
7
8
|
private getOptions;
|
|
8
9
|
onApplicationBootstrap(): Promise<void>;
|
|
9
|
-
|
|
10
|
+
get client(): KafkaClient;
|
|
11
|
+
produceMessage(topic: string, payload: any, key?: string): Promise<RecordMetadata[]>;
|
|
12
|
+
produceBatchMessages(topic: string, events: {
|
|
13
|
+
payload: string;
|
|
14
|
+
key?: string;
|
|
15
|
+
}[]): Promise<RecordMetadata[]>;
|
|
10
16
|
}
|
package/dist/kafka.service.js
CHANGED
|
@@ -48,9 +48,15 @@ let KafkaService = class KafkaService {
|
|
|
48
48
|
return this.kafka.createConsumer(consumerOptions, handler.bind(context));
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
get client() {
|
|
52
52
|
return this.kafka;
|
|
53
53
|
}
|
|
54
|
+
async produceMessage(topic, payload, key) {
|
|
55
|
+
return this.kafka.produceMessage(topic, payload, key);
|
|
56
|
+
}
|
|
57
|
+
async produceBatchMessages(topic, events) {
|
|
58
|
+
return this.kafka.produceBatchMessages(topic, events);
|
|
59
|
+
}
|
|
54
60
|
};
|
|
55
61
|
exports.KafkaService = KafkaService;
|
|
56
62
|
exports.KafkaService = KafkaService = __decorate([
|