Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 57x 57x 57x 57x 24x 24x 24x 10x 24x 8x 24x | import { TQueueParams, IPlugin } from 'redis-smq/dist/types'; import { ConsumerMessageRate } from './consumer/consumer-message-rate'; import { ConsumerMessageRateWriter } from './consumer/consumer-message-rate-writer'; import { Consumer, events } from 'redis-smq'; import { RedisClient } from 'redis-smq-common'; import { ICallback } from 'redis-smq-common/dist/types'; export class ConsumerMessageRatePlugin implements IPlugin { protected consumerMessageRate: ConsumerMessageRate; constructor( redisClient: RedisClient, queue: TQueueParams, consumer: Consumer, ) { const writer = new ConsumerMessageRateWriter( redisClient, queue, consumer.getId(), ); this.consumerMessageRate = new ConsumerMessageRate(writer); consumer.on(events.MESSAGE_ACKNOWLEDGED, () => this.consumerMessageRate.incrementAcknowledged(), ); consumer.on(events.MESSAGE_DEAD_LETTERED, () => this.consumerMessageRate.incrementDeadLettered(), ); } quit(cb: ICallback<void>): void { this.consumerMessageRate.quit(cb); } } |