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