mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-30 23:30:06 +00:00
[@types/kafka-node]: add missind Admin class and loadMetadataForTopics getListGroups and describeGroups methods (#27475)
This commit is contained in:
9
types/kafka-node/index.d.ts
vendored
9
types/kafka-node/index.d.ts
vendored
@@ -9,6 +9,7 @@
|
||||
export class Client {
|
||||
constructor(connectionString: string, clientId?: string, options?: ZKOptions, noBatchOptions?: AckBatchOptions, sslOptions?: any);
|
||||
close(cb?: () => void): void;
|
||||
loadMetadataForTopics(topics: string[], cb: (error: TopicsNotExistError | any, data: any) => any): void;
|
||||
topicExists(topics: string[], cb: (error?: TopicsNotExistError | any) => any): void;
|
||||
refreshMetadata(topics: string[], cb?: (error?: any) => any): void;
|
||||
sendOffsetCommitV2Request(group: string, generationId: number, memberId: string, commits: OffsetCommitRequest[], cb: (error: any, data: any) => any): void;
|
||||
@@ -20,6 +21,8 @@ export class Client {
|
||||
export class KafkaClient extends Client {
|
||||
constructor(options?: KafkaClientOptions);
|
||||
connect(): void;
|
||||
getListGroups(cb: (error: any, data: any) => any): void;
|
||||
describeGroups(consumerGroups: any, cb: (error: any, data: any) => any): void;
|
||||
}
|
||||
|
||||
export class Producer {
|
||||
@@ -93,6 +96,12 @@ export class KeyedMessage {
|
||||
constructor(key: string, value: string | Buffer);
|
||||
}
|
||||
|
||||
export class Admin {
|
||||
constructor(kafkaClient: KafkaClient);
|
||||
listGroups(cb: (error: any, data: any) => any): void;
|
||||
describeGroups(consumerGroups: any, cb: (error: any, data: any) => any): void;
|
||||
}
|
||||
|
||||
// # Interfaces
|
||||
|
||||
export interface Message {
|
||||
|
||||
@@ -14,6 +14,8 @@ const optionsClient = new kafka.Client('localhost:2181/', 'sendMessage', {
|
||||
});
|
||||
optionsClient.topicExists(['topic'], (error: any) => {
|
||||
});
|
||||
optionsClient.loadMetadataForTopics(['topic'], (error: any, data: any) => {
|
||||
});
|
||||
optionsClient.refreshMetadata(['topic'], (error: any) => {
|
||||
});
|
||||
optionsClient.close();
|
||||
@@ -48,6 +50,11 @@ const optionsProducer = new kafka.Producer(basicClient, {
|
||||
partitionerType: 0
|
||||
});
|
||||
|
||||
optionsKafkaClient.getListGroups((error: any, data: any) => {
|
||||
});
|
||||
optionsKafkaClient.describeGroups([], (error: any, data: any) => {
|
||||
});
|
||||
|
||||
const producer = new kafka.Producer(basicClient);
|
||||
producer.on('error', (error: Error) => {
|
||||
});
|
||||
@@ -265,3 +272,9 @@ offset.fetchLatestOffsets(['t'], (err, offsets) => {
|
||||
});
|
||||
offset.fetchEarliestOffsets(['t'], (err, offsets) => {
|
||||
});
|
||||
|
||||
const admin = new kafka.Admin(basicKafkaClient);
|
||||
admin.listGroups((err, data) => {
|
||||
});
|
||||
admin.describeGroups({}, (err, data) => {
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user