use of com.rabbitmq.client.BlockedListener in project rabbitmq-java-client by rabbitmq.
the class BlockedConnection method connection.
private Connection connection(final CountDownLatch latch) throws IOException, TimeoutException {
ConnectionFactory factory = TestUtils.connectionFactory();
Connection connection = factory.newConnection();
connection.addBlockedListener(new BlockedListener() {
public void handleBlocked(String reason) throws IOException {
try {
unblock();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public void handleUnblocked() throws IOException {
latch.countDown();
}
});
return connection;
}
Aggregations