private void initRabbitMQ() throws URISyntaxException {
CachingConnectionFactory connectionFactory = new CachingConnectionFactory(new URI(host));
Map<String, Object> cmdQueueArgs = new HashMap<>();
cmdQueueArgs.put("x-max-length", maxSize);
cmdQueueArgs.put("x-max-priority", maxPriority);
Queue cmdQueue = new Queue(name, true, false, false, cmdQueueArgs);
RabbitAdmin rabbitAdmin = new RabbitAdmin(connectionFactory);
rabbitAdmin.declareQueue(cmdQueue);
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
factory.setConnectionFactory(connectionFactory);
factory.setConcurrentConsumers(DEFAULT_CONCURRENCY);
factory.setMaxConcurrentConsumers(DEFAULT_CONCURRENCY);
factory.setTaskExecutor(executor);
factory.setAutoStartup(false);
template = new RabbitTemplate(connectionFactory);
template.setQueue(name);
SimpleRabbitListenerEndpoint simpleEndpoint = new SimpleRabbitListenerEndpoint();
simpleEndpoint.setMessageListener(new RabbitMessageListener());
container = factory.createListenerContainer(simpleEndpoint);
container.setQueueNames(name);
log.trace("RabbitMQ initialized on '{}' with queue name '{}'", host, name);
}