hapi-cnn-messaging

3.0.0 • Public • Published

hapi-cnn-messaging

NPM Package Build Status Coverage Status

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.

Package Sidebar

Install

npm i hapi-cnn-messaging

Weekly Downloads

2

Version

3.0.0

License

MIT

Last publish

Collaborators

  • cnn-ian