(channel: Channel, resolve: Function)
| 201 | } |
| 202 | |
| 203 | public async setupChannel(channel: Channel, resolve: Function) { |
| 204 | const prefetchCount = |
| 205 | this.getOptionsProp(this.options, 'prefetchCount') || |
| 206 | RQM_DEFAULT_PREFETCH_COUNT; |
| 207 | const isGlobalPrefetchCount = |
| 208 | this.getOptionsProp(this.options, 'isGlobalPrefetchCount') || |
| 209 | RQM_DEFAULT_IS_GLOBAL_PREFETCH_COUNT; |
| 210 | |
| 211 | if (!this.options.wildcards && this.options.exchangeType !== 'fanout') { |
| 212 | if (!this.noAssert) { |
| 213 | await channel.assertQueue(this.queue, this.queueOptions); |
| 214 | } |
| 215 | |
| 216 | if (this.options.exchange && this.options.routingKey) { |
| 217 | await channel.bindQueue( |
| 218 | this.queue, |
| 219 | this.options.exchange, |
| 220 | this.options.exchangeType === 'fanout' ? '' : this.options.routingKey, |
| 221 | ); |
| 222 | } |
| 223 | } else { |
| 224 | const exchange = this.getOptionsProp( |
| 225 | this.options, |
| 226 | 'exchange', |
| 227 | this.options.queue, |
| 228 | ); |
| 229 | const exchangeType = this.getOptionsProp( |
| 230 | this.options, |
| 231 | 'exchangeType', |
| 232 | 'topic', |
| 233 | ); |
| 234 | await channel.assertExchange(exchange, exchangeType, { |
| 235 | durable: true, |
| 236 | arguments: this.getOptionsProp(this.options, 'exchangeArguments', {}), |
| 237 | }); |
| 238 | } |
| 239 | |
| 240 | await channel.prefetch(prefetchCount, isGlobalPrefetchCount); |
| 241 | await this.consumeChannel(channel); |
| 242 | resolve(); |
| 243 | } |
| 244 | |
| 245 | public async consumeChannel(channel: Channel) { |
| 246 | const noAck = this.getOptionsProp(this.options, 'noAck', RQM_DEFAULT_NOACK); |
no test coverage detected