[@types/kafka-node]: add missind Admin class and loadMetadataForTopics getListGroups and describeGroups methods (#27475)

This commit is contained in:
Anatoly Tokalov
2018-07-27 20:43:04 +03:00
committed by Andy
parent 509d927c51
commit c083ea5eda
2 changed files with 22 additions and 0 deletions

View File

@@ -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 {

View File

@@ -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) => {
});