@@ -82,7 +82,7 @@ export class ConsumerGroupStream extends Readable {
82
82
close ( cb : ( ) => any ) : void ;
83
83
}
84
84
85
- export class ConsumerGroup {
85
+ export class ConsumerGroup extends EventEmitter {
86
86
generationId : number ;
87
87
memberId : string ;
88
88
client : KafkaClient ;
@@ -92,9 +92,9 @@ export class ConsumerGroup {
92
92
close ( force : boolean , cb : ( error : Error ) => any ) : void ;
93
93
close ( cb : ( error : Error ) => any ) : void ;
94
94
95
- on ( eventName : 'message' , cb : ( message : Message ) => any ) : void ;
96
- on ( eventName : 'error' | 'offsetOutOfRange' , cb : ( error : any ) => any ) : void ;
97
- on ( eventName : 'rebalancing' | 'rebalanced' | 'connect' , cb : ( ) => any ) : void ;
95
+ on ( eventName : 'message' , cb : ( message : Message ) => any ) : this ;
96
+ on ( eventName : 'error' | 'offsetOutOfRange' , cb : ( error : any ) => any ) : this ;
97
+ on ( eventName : 'rebalancing' | 'rebalanced' | 'connect' , cb : ( ) => any ) : this ;
98
98
99
99
addTopics ( topics : string [ ] | Topic [ ] , cb ?: ( error : any , added : string [ ] | Topic [ ] ) => any ) : void ;
100
100
@@ -112,11 +112,11 @@ export class ConsumerGroup {
112
112
resume ( ) : void ;
113
113
}
114
114
115
- export class Offset {
115
+ export class Offset extends EventEmitter {
116
116
constructor ( client : KafkaClient ) ;
117
117
118
- on ( eventName : 'ready' | 'connect' , cb : ( ) => any ) : void ;
119
- on ( eventName : 'error' , cb : ( error : any ) => any ) : void ;
118
+ on ( eventName : 'ready' | 'connect' , cb : ( ) => any ) : this ;
119
+ on ( eventName : 'error' , cb : ( error : any ) => any ) : this ;
120
120
121
121
fetch ( payloads : OffsetRequest [ ] , cb : ( error : any , data : any ) => any ) : void ;
122
122
@@ -145,6 +145,23 @@ export class ProducerStream extends Writable {
145
145
_writev ( chunks : Chunk [ ] , cb : ( error : any , data : any ) => any ) : void ;
146
146
}
147
147
148
+ export class Admin extends EventEmitter {
149
+ constructor ( kafkaClient : KafkaClient ) ;
150
+
151
+ on ( eventName : 'ready' | 'connect' , cb : ( ) => any ) : this;
152
+ on ( eventName : 'error' , cb : ( ) => any ) : this;
153
+
154
+ listGroups ( cb : ( error : any , res : any ) => any ) : void ;
155
+
156
+ listTopics ( cb : ( error : any , res : any ) => any ) : void ;
157
+
158
+ describeGroups ( consumerGroups : Array < string > , cb : ( error : any , res : any ) => any ) : void ;
159
+
160
+ createTopics ( topics : Array < CreateTopicRequest > , cb : ( error : any , res : any ) => any ) : void ;
161
+
162
+ describeConfigs ( payload : DescribeConfigsRequest , cb : ( error : any , res : any ) => any ) : void ;
163
+ }
164
+
148
165
// # Interfaces
149
166
150
167
export interface Message {
@@ -206,6 +223,7 @@ export interface ProduceRequest {
206
223
key ?: string | Buffer ;
207
224
partition ?: number ;
208
225
attributes ?: number ;
226
+ timestamp ?:number ; // defaults to Date.now() (only available with kafka v0.10+)
209
227
}
210
228
211
229
export interface ConsumerOptions {
@@ -348,3 +366,17 @@ export interface MetadataResponse extends Array<BrokerMetadataResponse|ClusterMe
348
366
0 : BrokerMetadataResponse ;
349
367
1 : ClusterMetadataResponse ;
350
368
}
369
+
370
+ export enum RESOURCE_TYPES {
371
+ topic = 'topic' ,
372
+ broker = 'broker'
373
+ }
374
+
375
+ export interface DescribeConfigsRequest {
376
+ resources : Array < {
377
+ resourceType : RESOURCE_TYPES ,
378
+ resourceName : string ,
379
+ configNames : Array < string >
380
+ } > ,
381
+ includeSynonyms ?: boolean
382
+ }
0 commit comments