use of com.rabbitmq.client.impl.nio.BlockingQueueNioQueue in project rabbitmq-java-client by rabbitmq.
the class JavaNioTest method customWriteQueue.
@Test
public void customWriteQueue() throws Exception {
ConnectionFactory cf = new ConnectionFactory();
cf.useNio();
AtomicInteger count = new AtomicInteger(0);
cf.setNioParams(new NioParams().setWriteQueueFactory(ctx -> {
count.incrementAndGet();
return new BlockingQueueNioQueue(new LinkedBlockingQueue<>(ctx.getNioParams().getWriteQueueCapacity()), ctx.getNioParams().getWriteEnqueuingTimeoutInMs());
}));
try (Connection c = cf.newConnection()) {
sendAndVerifyMessage(c, 100);
}
assertEquals(1, count.get());
}
Aggregations