-
Notifications
You must be signed in to change notification settings - Fork 2
Getting started
Rami edited this page Nov 3, 2019
·
4 revisions
{
"type": "TYPE_1",
"content": /* your message, can be any type (object, string, init, ...) */
}
const Router = require('queue-router').Router;
const router = new Router();
router.add('TYPE_1', {
handler: function(messageContent, attributes) { // Required
// your handling code
},
validation: { // Optional
schema: // Joi schema, https://github.com/hapijs/joi
}
});
const workerFactory = require('queue-router').workerFactory;
const worker = workerFactory.create(workerFactory.Types.SQS, router, config);
worker.init().then(() => worker.start());