()
| 194 | } |
| 195 | |
| 196 | public async bindTopics(): Promise<void> { |
| 197 | if (!this._consumer) { |
| 198 | throw Error('No consumer initialized'); |
| 199 | } |
| 200 | |
| 201 | const consumerSubscribeOptions = this.options.subscribe || {}; |
| 202 | |
| 203 | if (this.responsePatterns.length > 0) { |
| 204 | await this._consumer.subscribe({ |
| 205 | ...consumerSubscribeOptions, |
| 206 | topics: this.responsePatterns, |
| 207 | }); |
| 208 | } |
| 209 | |
| 210 | await this._consumer.run( |
| 211 | Object.assign(this.options.run || {}, { |
| 212 | eachMessage: this.createResponseCallback(), |
| 213 | }), |
| 214 | ); |
| 215 | } |
| 216 | |
| 217 | public createClient<T = any>(): T { |
| 218 | const kafkaConfig: KafkaConfig = Object.assign( |
no test coverage detected