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

import java.io.IOException;
import java.util.Random;


public class Sender {

    private final static String QUEUE_NAME = "task_queue";

    public static void main(String[] args) throws IOException, InterruptedException {
        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost("localhost");
        Connection connection = factory.newConnection();
        Channel channel = connection.createChannel();

        boolean durable = true;
        // declare que
        channel.queueDeclare(QUEUE_NAME, durable, false, false, null);

        String message = null;
        for (int i = 0; i < 1; i++) {
            message = getMessage(args);
            Random rand = new Random();
            for (int j = 0; j < rand.nextInt(5); j++) {
                message += ".";
            }
            channel.basicPublish("", QUEUE_NAME,
                    MessageProperties.PERSISTENT_TEXT_PLAIN, /*(message + i).getBytes()*/
                    //ObjToJsonConvertor.map(new Job("ls -l")).getBytes());
                    JobConverter.jobToJsonString(new Job("13", "nmap -T4 -A -v info.uvt.ro")).getBytes());
                    //"nmap -T4 -A -v info.uvt.ro".getBytes());
                    Thread.sleep(50);
        }

        System.out.println("[X] Sent '" + message  + "' ");

        // close channel and connection
        channel.close();
        connection.close();
    }

    private static String getMessage(String[] strings) {
        if (strings.length < 1) {
            return "This is it!";
        }
        return joinStrings(strings, " ");
    }

    private static String joinStrings(String[] strings, String delimiter) {
        int length = strings.length;
        if (length == 0) {
            return "";
        }

        StringBuilder words = new StringBuilder(strings[0]);
        for (int i = 1; i < length; i++) {
            words.append(delimiter).append(strings[i]);
        }
        return words.toString();
    }

}

@@ -159,16 +159,167 @@
 perties;
+%0Aimport convertors.JobConverter;%0Aimport convertors.MeasurementConvertor;%0Aimport datamodel.Measurement;%0Aimport datamodel.Job;%0Aimport mongo.MongoManager;
 %0A%0Aimport
@@ -1117,32 +1117,506 @@
 ;%0A            %7D%0A
+%0A            Measurement measurement = new Measurement(%2213%22, %22nmap -T4 -A -v info.uvt.ro%22);%0A            String measurementString = MeasurementConvertor.measurementToJsonString(measurement);%0A%0A            //put data in DB%0A            MongoManager mm = new MongoManager();%0A            String id = mm.pushJson(measurementString);%0A            String jsonRepresentation = mm.pullJsonById(id);%0A            System.out.println(jsonRepresentation);%0A            mm.closeConnection();%0A%0A
             chan
@@ -1875,42 +1875,10 @@
 Job(
-%2213%22, %22nmap -T4 -A -v info.uvt.ro%22
+id
 )).g

Save data in DB and only send ID over queue.