SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(template.getConnectionFactory());
container.setQueues(queue);
final CountDownLatch messageReceived = new CountDownLatch(1);
final CountDownLatch spiedQLogger = new CountDownLatch(1);
final CountDownLatch errorHandled = new CountDownLatch(1);
container.setErrorHandler(new ErrorHandler() {
@Override
public void handleError(Throwable t) {
errorHandled.countDown();
throw new AmqpRejectAndDontRequeueException("foo", t);