ManagedChannelBuilder
is an abstract class and there are concrete implementations like NettyChannelBuilder
and OkHttpChannelBuilder
. When you use an API like ManagedChannelBuilder.forTarget()
or Grpc.newChannelBuilder()
gRPC finds an appropriate concrete implementation based on your platform and returns it (normally OkHttp on Android; Netty otherwise).
The OkHttpChannelBuilder
and NettyChannelBuilder
APIs have more configuration options, but have no guaranteed API stability. This is because they expose options specific to the implementation and if the implementation changes (e.g., from Netty 4 to Netty 5) they may need to be changed or replaced. Because of this, you should prefer using ManagedChannelBuilder
when able.
There are also concrete implementations that won't be returned by ManagedChannelBuilder.forTarget()
, like InProcessChannelBuilder
, CronetChannelBuilder
, and AndroidChannelBuilder
. These are more specialized, either not "general purpose" or require additional configuration to work.