Skip to content

Instantly share code, notes, and snippets.

@nitindhar7
Created May 31, 2012 02:38
Show Gist options
  • Save nitindhar7/2840604 to your computer and use it in GitHub Desktop.
Save nitindhar7/2840604 to your computer and use it in GitHub Desktop.
Consuming messages in RabbitMQ
QueueingConsumer consumer = new QueueingConsumer(channel);
channel.basicConsume("registered-users", true, consumer);
while (true) {
QueueingConsumer.Delivery delivery = consumer.nextDelivery();
String message = new String(delivery.getBody());
System.out.println(" [x] Received '" + message + "'");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment