UNPKG

1.13 kBTypeScriptView Raw
1import * as SqsConsumer from 'sqs-consumer';
2export interface SqsWorkerConfigObject {
3 /**
4 * The queueUrl you are connecting to. (Default: localhost)
5 */
6 queueUrl?: string;
7 region?: string;
8 attributeNames?: Array<string>;
9 handleMessage?: Function;
10 batchSize?: number;
11 /**
12 * The milliseconds before a timeout occurs during the initial connection to the MySQL server. (Default: 10 seconds)
13 */
14 connectTimeout?: number;
15}
16export declare abstract class SqsHandler {
17 /**
18 *
19 * @param message
20 * @param done
21 */
22 abstract handle(message: Object, done: (err?: Error) => void): any;
23}
24export declare class SqsWorker {
25 static startMethod: string;
26 static stopMethod: string;
27 static lazy: boolean;
28 readonly maxRetries: number;
29 configuration: SqsWorkerConfigObject;
30 name: string;
31 consumerCreator: (config: SqsWorkerConfigObject) => SqsConsumer;
32 instance: SqsConsumer;
33 handler: SqsHandler;
34 constructor(configuration: SqsWorkerConfigObject, name: string);
35 initialise(): void;
36 shutdown(): void;
37 getMaxRetries(): number;
38}