public static boolean startDataAndCommandProcessing() { // establish connection RabbitMQListener listener = RabbitMQListener.getInstance(); // proceed only if connection was successful if (listener != null) { int threads = Runtime.getRuntime().availableProcessors(); boolean data = listener.addConsumer(consumerCredentials.getConsumerDataQueue(), new UsageConsumer(), threads); boolean command = listener.addConsumer(consumerCredentials.getConsumerCommandsQueue(), new CommandConsumer(true), 1); if (data && command) { logger.trace(String.format("RabbitMQ Consumers for %s and %s successfully initiated", consumerCredentials.getConsumerDataQueue(), consumerCredentials.getConsumerCommandsQueue())); return true; } else { stopDataAndCommandProcessing(); return false; } } return false; }
public static boolean startDataAndCommandProcessing() { // establish connection RabbitMQListener listener = RabbitMQListener.getInstance(); // proceed only if connection was successful if (listener != null) { int threads = Runtime.getRuntime().availableProcessors(); boolean data = listener.addConsumer(consumerCredentials.getConsumerDataQueue(), new BillConsumer(), threads); boolean command = listener.addConsumer(consumerCredentials.getConsumerCommandsQueue(), new CommandConsumer(true), 1); if (data && command) { logger.trace(String.format("RabbitMQ Consumers for %s and %s successfully initiated", consumerCredentials.getConsumerDataQueue(), consumerCredentials.getConsumerCommandsQueue())); return true; } else { stopDataAndCommandProcessing(); return false; } } return false; }
public static boolean startDataAndCommandProcessing() { // establish connection RabbitMQListener listener = RabbitMQListener.getInstance(); // proceed only if connection was successful if (listener != null) { int threads = Runtime.getRuntime().availableProcessors(); boolean data = listener.addConsumer(consumerCredentials.getConsumerDataQueue(), new CDRConsumer(), threads); boolean command = listener.addConsumer(consumerCredentials.getConsumerCommandsQueue(), new CommandConsumer(true), 1); if (data && command) { logger.trace(String.format("RabbitMQ Consumers for %s and %s successfully initiated", consumerCredentials.getConsumerDataQueue(), consumerCredentials.getConsumerCommandsQueue())); return true; } else { stopDataAndCommandProcessing(); return false; } } return false; }