Created
May 22, 2012 18:17
-
-
Save tjsnell/2770722 to your computer and use it in GitHub Desktop.
Oops!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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