@@ -82,7 +82,7 @@ export class ConsumerGroupStream extends Readable {
8282 close ( cb : ( ) => any ) : void ;
8383}
8484
85- export class ConsumerGroup {
85+ export class ConsumerGroup extends EventEmitter {
8686 generationId : number ;
8787 memberId : string ;
8888 client : KafkaClient ;
@@ -92,9 +92,9 @@ export class ConsumerGroup {
9292 close ( force : boolean , cb : ( error : Error ) => any ) : void ;
9393 close ( cb : ( error : Error ) => any ) : void ;
9494
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 ;
9898
9999 addTopics ( topics : string [ ] | Topic [ ] , cb ?: ( error : any , added : string [ ] | Topic [ ] ) => any ) : void ;
100100
@@ -112,11 +112,11 @@ export class ConsumerGroup {
112112 resume ( ) : void ;
113113}
114114
115- export class Offset {
115+ export class Offset extends EventEmitter {
116116 constructor ( client : KafkaClient ) ;
117117
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 ;
120120
121121 fetch ( payloads : OffsetRequest [ ] , cb : ( error : any , data : any ) => any ) : void ;
122122
@@ -145,6 +145,23 @@ export class ProducerStream extends Writable {
145145 _writev ( chunks : Chunk [ ] , cb : ( error : any , data : any ) => any ) : void ;
146146}
147147
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+
148165// # Interfaces
149166
150167export interface Message {
@@ -206,6 +223,7 @@ export interface ProduceRequest {
206223 key ?: string | Buffer ;
207224 partition ?: number ;
208225 attributes ?: number ;
226+ timestamp ?:number ; // defaults to Date.now() (only available with kafka v0.10+)
209227}
210228
211229export interface ConsumerOptions {
@@ -348,3 +366,17 @@ export interface MetadataResponse extends Array<BrokerMetadataResponse|ClusterMe
348366 0 : BrokerMetadataResponse ;
349367 1 : ClusterMetadataResponse ;
350368}
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