new Connect(customLogger)
Creates a new Listener instance
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
customLogger |
customLogger |
<optional> |
require('./loggerService.js') | A custom logger object |
- Source:
Example
var subscriber = require('amqplib-lite'); // Custom logger passed in let client = new RabbitClient(customLogObj); client.handlers = handlers; // when a disconnect happens this handler property will be used to reconnect internally client.connect(config).then((connection) => { client.registerHandlers(handlers, connection); }).catch(error => { logger.error("Error occurred while bootstrapping queue handlers: ", error); }); // No custom logger pass in let client = new RabbitClient(); client.handlers = handlers; // when a disconnect happens this handler property will be used to reconnect internally client.connect(config).then((connection) => { client.registerHandlers(handlers, connection); }).catch(error => { logger.error("Error occurred while bootstrapping queue handlers: ", error); });
Methods
-
registerPublisher(config, amqpConn)
-
Used to register new channels on connections that exist, it also checks that the publishing exchange is reachable
Parameters:
Name Type Description config
amqpConn
- Source: