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