hapi-cnn-messaging
v3.0.0
Published
Wraps cnn-messaging module in a hapi plugin
Downloads
3
Maintainers
Readme
hapi-cnn-messaging
This is a hapi.js plugin that wraps hapi-cnn-messaging to provide graceful shutdown.
The module creates an instance of messenger, that is bound to the hapi server object.
setup
server.register({
register: require('hapi-cnn-messaging'),
options: {
amqp: {
connectionString: 'amqp://localhost:5672',
exchangeName: 'EXAMPLE_APP'
}
}
}, (err) => {
if (err) {
throw err;
}
});
publishing a message
server.app.messenger.publish(new server.app.Message({
context: {
systemId: 'test',
environment: 'local',
model: 'message',
objectId: 123,
action: 'insert'
},
event: {
some: 'thing'
}
}));
See tests for further usage examples.
See the documentation for cnn-messaging for details.