Channel channel = connection.createChannel();
// Establish the REQ/REP wiring.
String queueName = channel.queueDeclare().getQueue();
QueueingConsumer consumer = new QueueingConsumer(channel);
channel.basicConsume(queueName, true, consumer);
// Send the request
AMQP.BasicProperties properties = new AMQP.BasicProperties();
properties.setReplyTo(queueName);
channel.basicPublish("", "REQREP", properties,