paricafe/src/queue/processors/http/index.ts

20 lines
371 B
TypeScript
Raw Normal View History

2018-04-07 01:45:03 -05:00
import deliver from './deliver';
2018-04-02 04:36:47 -05:00
import processInbox from './process-inbox';
import { queueLogger } from '../..';
2018-03-31 05:55:00 -05:00
2018-06-18 00:28:43 -05:00
const handlers: any = {
2018-04-07 01:45:03 -05:00
deliver,
processInbox,
2018-03-31 05:55:00 -05:00
};
2018-06-18 00:28:43 -05:00
export default (job: any, done: any) => {
2018-04-07 01:45:03 -05:00
const handler = handlers[job.data.type];
if (handler) {
handler(job, done);
} else {
queueLogger.error(`Unknown job: ${job.data.type}`);
2018-04-07 01:45:03 -05:00
done();
}
};