// Connect to the AMQP broker
ConnectionFactory factory = new ConnectionFactory();
factory.setHost(hostName);
factory.setPort(portNumber);
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();
// Establish the REQ/REP wiring.
channel.queueDeclare("REQREP", true, false, false, null);
QueueingConsumer consumer = new QueueingConsumer(channel);