Skip to content

Commit

Permalink
Add tsdoc for consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
mugli committed Aug 16, 2019
1 parent e2efc4b commit 80fa61c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/producer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import { waitUntilInitialized } from './common';
import { defaultOptions } from './defaults';

export interface ProducerOptions {
redisOptions?: IORedis.RedisOptions;
redisClient?: IORedis.Redis;

redisOptions?: IORedis.RedisOptions;
}

export class Producer {
Expand All @@ -18,6 +19,17 @@ export class Producer {
_isInitialized: boolean = false;
_redisOptions: IORedis.RedisOptions = defaultOptions.redisOptions;

/**
* Create a new Producer for a queue
* @param qname name of the queue.
*
* @param options.redisClient Optional. redisClient is an instance of `ioredis`
* which will be used to duplicate configs to create a new redis connection.
*
* `options.redisClient` is used over `options.redisOptions` if both are present.
*
* @param options.redisOptions Optional. Any valid `ioredis` options.
*/
constructor(qname: string, { redisOptions, redisClient }: ProducerOptions = {}) {
if (redisClient) {
this._redis = redisClient.duplicate() as Redis;
Expand Down

0 comments on commit 80fa61c

Please sign in to comment.