Skip to content

Commit 2d06e28

Browse files
committed
Setting the right channel
1 parent 16faff3 commit 2d06e28

File tree

1 file changed

+5
-2
lines changed
  • extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports

1 file changed

+5
-2
lines changed

extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/Channels.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.util.concurrent.TimeUnit;
2828
import java.util.concurrent.TimeoutException;
2929

30+
import io.netty.channel.socket.nio.NioSocketChannel;
3031
import jakarta.enterprise.context.spi.CreationalContext;
3132
import jakarta.enterprise.inject.Any;
3233
import jakarta.enterprise.util.TypeLiteral;
@@ -210,14 +211,16 @@ public static Channel createChannel(String name, Set<String> perClientIntercepto
210211
NettyChannelBuilder ncBuilder = (NettyChannelBuilder) builder;
211212
// just use the existing Vertx event loop group, if possible
212213
Vertx vertx = container.instance(Vertx.class).get();
213-
if (vertx != null) {
214+
// only support NIO for now, since Vertx::transport is not exposed in the API
215+
if (vertx != null && vertx.isNativeTransportEnabled()) {
214216
// see https://github.com/eclipse-vertx/vert.x/pull/5292
215217
boolean reuseNettyAllocators = Boolean.getBoolean("vertx.reuseNettyAllocators");
216218
if (reuseNettyAllocators) {
217219
// let Netty Grpc to re-use the default Netty allocator as well
218220
System.setProperty("io.grpc.netty.useCustomAllocator", "false");
219221
}
220-
ncBuilder = ncBuilder.eventLoopGroup(vertx.nettyEventLoopGroup());
222+
ncBuilder = ncBuilder.eventLoopGroup(vertx.nettyEventLoopGroup())
223+
.channelType(NioSocketChannel.class);
221224
}
222225
builder = ncBuilder
223226
// clients are intercepted using the IOThreadClientInterceptor interceptor which will decide on which

0 commit comments

Comments
 (0)