File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -39,23 +39,26 @@ module.exports = function loopbackComponentMq(app, settings) {
3939 RabbitMQ . log = _ . get ( settings , 'options.log' , console )
4040 RabbitMQ . log = typeof RabbitMQ . log === 'string' ? require ( RabbitMQ . log ) : RabbitMQ . log
4141
42+ // Handle the case where unable to connect to Rabbit.
4243 rabbit . on ( 'unreachable' , ( ) => {
4344 RabbitMQ . log . error ( 'Unable to connect to Rabbit' )
44- throw new Error ( 'Unable to connect to Rabbit' )
45+ process . exit ( 1 )
4546 } )
4647
4748 // Graceful shutdown.
4849 process . on ( 'SIGINT' , ( ) => {
4950 debug ( 'Caught SIGINT - performing graceful shutdown...' )
5051 rabbit . shutdown ( )
51- process . exit ( 0 )
52+ process . exit ( 1 )
5253 } )
5354
5455 // Configure the rabbit topology.
5556 rabbit . configure ( settings . topology )
5657 . then ( ( ) => debug ( 'Rabbit topology configured' ) )
57- . catch ( err => RabbitMQ . log . error ( err ) )
58-
58+ . catch ( err => {
59+ RabbitMQ . log . error ( 'Unable to configure Rabbit topology' , err . cause )
60+ process . exit ( 1 )
61+ } )
5962
6063 const connection = rabbit . configurations . default . connection
6164 const parsedConnectionUri = url . parse ( connection . uri )
You can’t perform that action at this time.
0 commit comments