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