Skip to content

Instantly share code, notes, and snippets.

@tjsnell
Created May 22, 2012 18:17
Show Gist options
  • Save tjsnell/2770722 to your computer and use it in GitHub Desktop.
Save tjsnell/2770722 to your computer and use it in GitHub Desktop.
Oops!
public class MyConsumer extends com.rabbitmq.client.DefaultConsumer {
/**
* Constructs a new instance and records its association to the passed-in channel.
*
* @param channel the channel to which this consumer is attached
*/
public MyConsumer(Channel channel) {
super(channel);
}
@Override
public void handleDelivery(String consumerTag,
Envelope envelope,
AMQP.BasicProperties properties,
byte[] body) throws IOException {
String routingKey = envelope.getRoutingKey();
String contentType = properties.getContentType();
long deliveryTag = envelope.getDeliveryTag();
Exchange exchange = endpoint.createExchange(envelope, properties, body);
try {
getProcessor().process(exchange);
} catch (Exception e) {
e.printStackTrace();
}
exchange.addOnCompletion(new Synch());
try {
getProcessor().process(exchange);
} catch (Exception e) {
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment