package io.jrocket.robustrabbit;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.QueueingConsumer;

/**
 * User: OCTO-JBU
 * Date: 21/04/2014
 * Time: 00:57
 */
public class Consumer {
    private final static String QUEUE_NAME = "RobustRabbit";

    public static void main(String[] argv) throws java.io.IOException, java.lang.InterruptedException {
        // Declare a new RabbitMQ connection factory
        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost("localhost");

        // Open a new connection to the Broker
        Connection connection = factory.newConnection();
        Channel channel = connection.createChannel();
        channel.queueDeclare(QUEUE_NAME, false, false, false, null);

        System.out.println(" [*] Waiting for messages. To exit press CTRL+C");

        // Declare a new QueueingConsumer and assign it to the channel
        QueueingConsumer consumer = new QueueingConsumer(channel);
        channel.basicConsume(QUEUE_NAME, true, consumer);

        while (true) {
            QueueingConsumer.Delivery delivery = consumer.nextDelivery();
            String message = new String(delivery.getBody());
            System.out.println(" [x] Received '" + message + "'");
        }
    }
}

@@ -192,16 +192,73 @@
 onsumer;
+%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;
 %0A%0A/**%0A *
@@ -336,16 +336,100 @@
 sumer %7B%0A
+%0A    private static final Logger LOGGER = LoggerFactory.getLogger(Consumer.class);%0A%0A
     priv
@@ -975,34 +975,27 @@
         
-System.out.println
+LOGGER.info
 (%22 %5B*%5D W
@@ -1411,26 +1411,19 @@
     
-System.out.println
+LOGGER.info
 (%22 %5B

Change Logger