- Listen to requester error and log it
- Update test and ReadMe using rabbot instead of wascally
- Fix rabbot issue with publishing array
- Update dependencies
- Update node support to node 6
- Refactor code to some ES2015 conventions
- Fix timeouts in responder
- Change
Receiver
parameter from callback to send object
Usage
// send is a object with success, fail and error attribs
lapin.receive( function ( message, send ) {
// can use
send.success( data );
// or
send.fail( error );
// or
send.error( error );
} );
- Refactor responder calls
- Pass Joi validated message instead of the original
- Fix unacked when timeout occurs
- Handle multiple respond calls in one request
- Log error messages
- Fix for invalid options in lapin
- Add timeout handler. Request will timeout after 40s
- Fix logging inside rabbit
- Fix options passed in lapin
- Add logger support
Usage
var rabbit = require( 'wascally' );
var lapin = require( 'lapin' )( rabbit );
// or
var options = {
'logger' : logger,
'rabbit' : wascally
};
var lapin = require( 'lapin' )( options )
- Fix remove deep clone when transforming wascally/rabbus options.
- Support array of messageTypes in Responders
- Emit lapin errors instead of throw
Usage
lapin.respond( [ 'v1.resources.action', 'v2.resources.action' ], function ( message, send ) {} );
- Support other options of rabbus/wascally in Consumer and Producers
Usage
options = 'v1.logs.log';
// or
options = {
'messageType' : 'v1.logs.log',
'exchange' : 'logs'
}
lapin.send( options , message, function ( error, data ) {
// handling the response is optional
if ( !error ) {
console.log( response );
}
} );
- Remove log to service
- Remove console.log for success replies in Responder
- Incorporate JOI validation to Responder
Usage
var rabbit = require( 'wascally' );
var lapin = require( 'lapin' )( rabbit );
// Responder
lapin.respond( {
'messageType' : 'v1.users.findAll',
'validate' : Joi.object().keys( {
'username' : Joi.string().alphanum().min( 3 ).max( 30 ).required(),
'password' : Joi.string().regex( /[a-zA-Z0-9]{3,30}/ ),
'access_token' : [ Joi.string(), Joi.number() ],
'birthyear' : Joi.number().integer().min( 1900 ).max( 2013 ),
'email' : Joi.string().email()
} ).with( 'username', 'birthyear' ).without( 'password', 'access_token' ),
'validateOptions' : {} // <optional> see https://github.com/hapijs/joi for validation options
} , function ( message, respond ) {
// consumer process
} );
- Remove error listener possible event leak fix
- Add console.log for success replies in Responder
- Add console.log for fail and error replies in Responder
- Revert to old rabbus ( 0.2.x )
- Support JSEND success, error, fail replies in respond( request-respond pattern ). See
Usage
- Updated to rabbus 0.4.x
Usage
// Responder
lapin.respond( 'v1.users.findAll', function ( message, send ) {
if ( message.invalid ) {
return send.fail( 'Invalid data' );
}
someDatabaseQuery().then( function ( result ) {
// JSend success with data
send.success( result );
} ).catch( function handleError ( error ) {
// JSend error
send.error( 'Failed query', error, 500 );
// or -- code is optional
send.error( 'Failed query', error );
// or -- data is optional
send.error( 'Failed query' );
} );
} );
- Added promise request and send functions
Usage
lapin.sendPromise( 'v1.logs.log', message )
.then( function ( response ) {
} )
.catch( function ( error ) {
} );
lapin.requestPromise( 'v1.users.findAll', message )
.then( function ( data ) {
} )
.catch( function ( error ) {
} );
- Add logging through a service
- Listen to errors emitted by patterns
- Trap invalid data during request, send and publish
Usage
var rabbit = require( 'wascally' );
var lapinOptions = {
'rabbit' : rabbit,
'logService' : {
'prefix' : 'v1.logs.logService'
}
};
var lapin = require( 'lapin' )( lapinOptions );
// or no logging
var rabbit = require( 'wascally' );
var lapin = require( 'lapin' )( rabbit );
- Revert back original lapin invocation. See
Usage
below.
Usage
var rabbit = require( 'wascally' );
var lapin = require( 'lapin' )( rabbit );
lapin.request( 'v1.users.findAll', options, function ( error, response ) {} )
// Response
lapin.respond( 'v1.users.findAll', function ( message, send ) {} )
- Change expose attributes to lowercase
Usage
// Sender
var sender = lapin.sender( { 'messageType' : 'v1.logs.log' } );
sender.produce( message, function ( error, response ) {
} );
// Receiver
var receiver = lapin.receiver( { 'messageType' : 'v1.logs.log' } );
receiver.consume( function ( message, done ) {
} );
- Fix possible memory leak with the creation of the same messageTypes
- Add send-receive pattern
- Add publish-subscribe pattern
Usage
// Sender
var sender = new lapin.Sender( { 'messageType' : 'v1.logs.log' } );
sender.produce( message, function ( error, response ) {
} );
// Receiver
var receiver = new lapin.Receiver( { 'messageType' : 'v1.logs.log' } );
receiver.consume( function ( message, done ) {
} );
- Add request-respond pattern
Usage
lapin.request( 'v1.users.findAll', options, function ( error, data ) {} )
// Response
lapin.response( 'v1.users.findAll', function ( options, reply ) {} )