-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathmqemitter-redis.d.ts
More file actions
44 lines (38 loc) · 1.31 KB
/
Copy pathmqemitter-redis.d.ts
File metadata and controls
44 lines (38 loc) · 1.31 KB
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
35
36
37
38
39
40
41
42
43
44
import type { RedisOptions } from 'ioredis'
import type { MQEmitter } from 'mqemitter'
declare namespace MQEmitterRedis {
export interface MQEmitterOptions {
concurrency?: number;
matchEmptyLevels?: boolean;
separator?: string;
wildcardOne?: string;
wildcardSome?: string;
connectionString?: string;
}
export interface LRUCacheOptions {
ttlLRUCache?: number;// Time to live for the LRU cache in milliseconds
maxLRUCache?: number;// Maximum number of items in the LRU cache
}
export type Message = Record<string, any> & { topic: string }
export interface MQEmitterRedis extends MQEmitter {
new (options?: MQEmitterOptions & RedisOptions & LRUCacheOptions): MQEmitterRedis;
current: number;
concurrent: number;
on(
topic: string,
listener: (message: Message, done: () => void) => void,
callback?: () => void
): this;
emit(message: Message, callback?: (error?: Error) => void): void;
removeListener(
topic: string,
listener: (message: Message, done: () => void) => void,
callback?: () => void
): void;
close(callback: () => void): void;
}
}
declare function MQEmitterRedis (
options?: MQEmitterRedis.MQEmitterOptions & RedisOptions & MQEmitterRedis.LRUCacheOptions
): MQEmitterRedis.MQEmitterRedis
export = MQEmitterRedis