/** * Initialise connection to RabbitMQ */ private void initialiseConnection(ConsumerCredentials credentials) { // connect to the RabbitMQ based on settings from Load ConnectionFactory factory = new ConnectionFactory(); factory.setUsername(credentials.getConsumerUsername()); factory.setPassword(credentials.getConsumerPassword()); factory.setHost(credentials.getConsumerHost()); factory.setPort(credentials.getConsumerPort()); factory.setVirtualHost(credentials.getConsumerVirtualHost()); factory.setAutomaticRecoveryEnabled(true); try { // create new connection connection = factory.newConnection(); logger.trace(String.format("RabbitMQ Consumer connected to %s:%d", credentials.getConsumerHost(), credentials.getConsumerPort())); } catch (Exception e) { logger.error(String.format("RabbitMQ Consumer couldn't be created: %s", e.getMessage())); connection = null; } }
/** * Initialise connection to RabbitMQ */ private void initialiseConnection(ConsumerCredentials credentials) { // connect to the RabbitMQ based on settings from Load ConnectionFactory factory = new ConnectionFactory(); factory.setUsername(credentials.getConsumerUsername()); factory.setPassword(credentials.getConsumerPassword()); factory.setHost(credentials.getConsumerHost()); factory.setPort(credentials.getConsumerPort()); factory.setVirtualHost(credentials.getConsumerVirtualHost()); factory.setAutomaticRecoveryEnabled(true); try { // create new connection connection = factory.newConnection(); logger.trace(String.format("RabbitMQ Consumer connected to %s:%d", credentials.getConsumerHost(), credentials.getConsumerPort())); } catch (Exception e) { logger.error(String.format("RabbitMQ Consumer couldn't be created: %s", e.getMessage())); connection = null; } }
/** * Initialise connection to RabbitMQ */ private void initialiseConnection(ConsumerCredentials credentials) { // connect to the RabbitMQ based on settings from Load ConnectionFactory factory = new ConnectionFactory(); factory.setUsername(credentials.getConsumerUsername()); factory.setPassword(credentials.getConsumerPassword()); factory.setHost(credentials.getConsumerHost()); factory.setPort(credentials.getConsumerPort()); factory.setVirtualHost(credentials.getConsumerVirtualHost()); factory.setAutomaticRecoveryEnabled(true); try { // create new connection connection = factory.newConnection(); logger.trace(String.format("RabbitMQ Consumer connected to %s:%d", credentials.getConsumerHost(), credentials.getConsumerPort())); } catch (Exception e) { logger.error(String.format("RabbitMQ Consumer couldn't be created: %s", e.getMessage())); connection = null; } }
/** * Initialise connection to RabbitMQ */ private void initialiseConnection(ConsumerCredentials credentials) { // connect to the RabbitMQ based on settings from Load ConnectionFactory factory = new ConnectionFactory(); factory.setUsername(credentials.getConsumerUsername()); factory.setPassword(credentials.getConsumerPassword()); factory.setHost(credentials.getConsumerHost()); factory.setPort(credentials.getConsumerPort()); factory.setVirtualHost(credentials.getConsumerVirtualHost()); factory.setAutomaticRecoveryEnabled(true); try { // create new connection connection = factory.newConnection(); logger.trace(String.format("RabbitMQ Consumer connected to %s:%d", credentials.getConsumerHost(), credentials.getConsumerPort())); } catch (Exception e) { logger.error(String.format("RabbitMQ Consumer couldn't be created: %s", e.getMessage())); connection = null; } }