mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
[kafka-node] New Admin class methods (#37876)
* Added Admin class new methods https://www.npmjs.com/package/kafka-node#admin * Fixed tslint issues, added tests. * fixed identation
This commit is contained in:
parent
5d2b848c4a
commit
f560b262e0
36
types/kafka-node/index.d.ts
vendored
36
types/kafka-node/index.d.ts
vendored
@ -5,6 +5,7 @@
|
||||
// Michael Haan <https://github.com/sfrooster>
|
||||
// Amiram Korach <https://github.com/amiram>
|
||||
// Insanehong <https://github.com/insanehong>
|
||||
// Roger <https://github.com/rstpv>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
@ -103,9 +104,32 @@ export class KeyedMessage {
|
||||
export class Admin {
|
||||
constructor(kafkaClient: KafkaClient);
|
||||
listGroups(cb: (error: any, data: any) => any): void;
|
||||
describeGroups(consumerGroups: any, cb: (error: any, data: any) => any): void;
|
||||
describeGroups(
|
||||
consumerGroups: any,
|
||||
cb: (error: any, data: any) => any,
|
||||
): void;
|
||||
listTopics(cb: (error: any, data: any) => any): void;
|
||||
createTopics(
|
||||
topics: TopicConfigData[],
|
||||
cb: (error: any, data: any) => any,
|
||||
): void;
|
||||
describeConfigs(
|
||||
payload: { resources: Resource[]; includeSynonyms: boolean },
|
||||
cb: (error: any, data: any) => any,
|
||||
): void;
|
||||
}
|
||||
export interface Resource {
|
||||
resourceType: string;
|
||||
resourceName: string;
|
||||
configNames: string[];
|
||||
}
|
||||
|
||||
export interface TopicConfigData {
|
||||
topic: string;
|
||||
partitions?: number;
|
||||
replicationFactor?: number;
|
||||
configEntry?: Array<{ name: string; value: string }>;
|
||||
}
|
||||
// # Interfaces
|
||||
|
||||
export interface Message {
|
||||
@ -115,7 +139,7 @@ export interface Message {
|
||||
partition?: number;
|
||||
highWaterOffset?: number;
|
||||
key?: string;
|
||||
}
|
||||
}
|
||||
|
||||
export interface ProducerOptions {
|
||||
requireAcks?: number;
|
||||
@ -173,10 +197,10 @@ export interface ConsumerOptions {
|
||||
}
|
||||
|
||||
export interface HighLevelConsumerOptions extends ConsumerOptions {
|
||||
id?: string;
|
||||
maxNumSegments?: number;
|
||||
maxTickMessages?: number;
|
||||
rebalanceRetry?: RetryOptions;
|
||||
id?: string;
|
||||
maxNumSegments?: number;
|
||||
maxTickMessages?: number;
|
||||
rebalanceRetry?: RetryOptions;
|
||||
}
|
||||
|
||||
export interface CustomPartitionAssignmentProtocol {
|
||||
|
||||
@ -280,3 +280,19 @@ admin.listGroups((err, data) => {
|
||||
});
|
||||
admin.describeGroups({}, (err, data) => {
|
||||
});
|
||||
admin.createTopics([{ topic: 'testing' }], (err, data) => {});
|
||||
admin.listTopics((err, data) => {
|
||||
});
|
||||
|
||||
const resource = {
|
||||
resourceType: "", // 'broker' or 'topic'
|
||||
resourceName: 'my-topic-name',
|
||||
configNames: [] // specific config names, or empty array to return all,
|
||||
};
|
||||
const payload = {
|
||||
resources: [resource],
|
||||
includeSynonyms: false // requires kafka 2.0+
|
||||
};
|
||||
admin.describeConfigs(payload, (err, res) => {
|
||||
console.log(JSON.stringify(res, null, 1));
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user