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

import java.io.IOException;

public class Receiver {
    private Channel channel;
    QueueingConsumer consumer;
    private final static String HOST_NAME = "localhost";
    private final static String QUEUE_NAME = "task_queue";

    public Receiver() {
        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost(HOST_NAME);
        Connection connection = null;
        try {
            connection = factory.newConnection();
            channel = connection.createChannel();

            /*
            * a client can be assigned only 1 message, the next message will be
            * assigned only after it finishes processing the first message
            */
            int prefetchCount = 1;

            channel.basicQos(prefetchCount);
            boolean durable = true;
            channel.queueDeclare(QUEUE_NAME, durable, false, false, null);
            consumer = new QueueingConsumer(channel);
            boolean autoAck = false;
            channel.basicConsume(QUEUE_NAME, autoAck, consumer);


        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void startReceiving() {
        while (true) {
            try {
                QueueingConsumer.Delivery delivery = consumer.nextDelivery();
                String message = new String(delivery.getBody());
                doWork(message);
                channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false);
                System.out.println("[X] Done");
            } catch (InterruptedException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    private void doWork(String command) throws InterruptedException {
        Command cmd = new Command(command);
        cmd.execute();
    }
}

@@ -390,16 +390,76 @@
 ueue%22;%0A%0A
+    /**%0A     * set parameters for RabbitMQ receiver%0A     */%0A
     publ
@@ -1339,24 +1339,67 @@
    %7D%0A    %7D%0A%0A
+    /**%0A     * Listen for messages%0A     */%0A
     public v
@@ -1417,24 +1417,24 @@
 ceiving() %7B%0A
-
         whil
@@ -1621,22 +1621,30 @@
         
-doWork
+executeCommand
 (message
@@ -1962,24 +1962,189 @@
    %7D%0A    %7D%0A%0A
+    /**%0A     * Start a command with received message%0A     *%0A     * @param command terminal command that will be executed%0A     * @throws InterruptedException%0A     */%0A
     private 
@@ -2152,14 +2152,22 @@
 oid 
-doWork
+executeCommand
 (Str

Add comments, rename method.