High-performance in-process transport implementation for gRPC Java that enables direct communication between client and server within the same JVM process
npx @tessl/cli install tessl/maven-io-grpc--grpc-inprocess@1.73.0gRPC In-Process Transport provides a high-performance transport implementation for gRPC Java that enables direct communication between client and server within the same JVM process. This transport bypasses network serialization entirely while maintaining full gRPC semantics and features including streaming, metadata, deadlines, and cancellation.
Package Name: grpc-inprocess
Package Type: maven
Language: Java
Installation:
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-inprocess</artifactId>
<version>1.73.0</version>
</dependency>Gradle:
implementation 'io.grpc:grpc-inprocess:1.73.0'import io.grpc.inprocess.InProcessChannelBuilder;
import io.grpc.inprocess.InProcessServerBuilder;
import io.grpc.inprocess.InProcessSocketAddress;
import io.grpc.inprocess.AnonymousInProcessSocketAddress;import io.grpc.inprocess.InProcessChannelBuilder;
import io.grpc.inprocess.InProcessServerBuilder;
import io.grpc.Channel;
import io.grpc.Server;
import java.util.concurrent.TimeUnit;
// Generate unique server name for testing
String serverName = InProcessServerBuilder.generateName();
// Create and start in-process server
Server server = InProcessServerBuilder.forName(serverName)
.directExecutor() // Use direct executor for testing
.addService(new MyGrpcService()) // Add your gRPC service
.build()
.start();
// Create client channel to connect to the server
Channel channel = InProcessChannelBuilder.forName(serverName)
.directExecutor()
.build();
// Use channel with your gRPC stubs
MyServiceGrpc.MyServiceBlockingStub stub =
MyServiceGrpc.newBlockingStub(channel);
// Make gRPC calls
MyResponse response = stub.myMethod(MyRequest.newBuilder().build());The gRPC In-Process Transport is built around several key components:
InProcessChannelBuilder and InProcessServerBuilder provide fluent APIs for creating channels and serversInProcessSocketAddress and AnonymousInProcessSocketAddress identify server endpointsCreate in-process channels that connect to named or addressed servers with comprehensive configuration options.
public static InProcessChannelBuilder forName(String name);
public static InProcessChannelBuilder forTarget(String target);
public static InProcessChannelBuilder forAddress(SocketAddress address);Create in-process servers that can be identified by name or anonymous address with full gRPC server capabilities.
public static InProcessServerBuilder forName(String name);
public static InProcessServerBuilder forAddress(SocketAddress listenAddress);
public static String generateName();Addressing system for in-process servers supporting both named and anonymous server identification.
public final class InProcessSocketAddress extends SocketAddress {
public InProcessSocketAddress(String name);
public String getName();
}
public final class AnonymousInProcessSocketAddress extends SocketAddress {
public AnonymousInProcessSocketAddress();
}