forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rsmq-worker.d.ts
53 lines (45 loc) · 1.66 KB
/
rsmq-worker.d.ts
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
45
46
47
48
49
50
51
52
53
// Type definitions for rsmq-worker 0.3.5
// Project: http://smrchy.github.io/rsmq/rsmq-worker/
// Definitions by: TANAKA Koichi <https://github.com/MugeSo>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path='../rsmq/rsmq.d.ts'/>
declare module "rsmq-worker" {
import redis = require('redis');
import events = require('events');
module RSMQWorker {
export interface Client extends events.EventEmitter {
start(): Client;
stop(): Client;
send(message: string, delay?: number, cb?: CallbackT<string>): Client;
send(message: string, cb: CallbackT<string>): Client;
del(id: string, cb?: CallbackT<void>): Client;
changeInterval(interval: number|number[]): Client;
}
export interface Options {
interval?: number;
maxReceiveCount?: number;
invisibletime?: number;
defaultDelay?: number;
autostart?: boolean;
timeout?: number;
customExceedCheck?: CustomExceedCheckCallback;
rsmq?: RedisSMQ.Client;
redis?: redis.RedisClient;
redisPrefix?: string;
host?: string;
port?: number;
options?: redis.ClientOpts;
}
export interface CustomExceedCheckCallback {
(message: RedisSMQ.Message): boolean;
}
export interface CallbackT<R> {
(e?:Error, res?:R): void;
}
}
interface RSMQWorkerStatic {
new(queuename: string, options?: RSMQWorker.Options): RSMQWorker.Client;
}
var RSMQWorker: RSMQWorkerStatic;
export = RSMQWorker;
}