or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

channel-builder.mdindex.mdserver-builder.mdsocket-addresses.md
tile.json

tessl/maven-io-grpc--grpc-inprocess

High-performance in-process transport implementation for gRPC Java that enables direct communication between client and server within the same JVM process

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/io.grpc/grpc-inprocess@1.73.x

To install, run

npx @tessl/cli install tessl/maven-io-grpc--grpc-inprocess@1.73.0

index.mddocs/

gRPC In-Process Transport

gRPC 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 Information

  • 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'

Core Imports

import io.grpc.inprocess.InProcessChannelBuilder;
import io.grpc.inprocess.InProcessServerBuilder;
import io.grpc.inprocess.InProcessSocketAddress;
import io.grpc.inprocess.AnonymousInProcessSocketAddress;

Basic Usage

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());

Architecture

The gRPC In-Process Transport is built around several key components:

  • Builders: InProcessChannelBuilder and InProcessServerBuilder provide fluent APIs for creating channels and servers
  • Socket Addresses: InProcessSocketAddress and AnonymousInProcessSocketAddress identify server endpoints
  • Transport Layer: Internal transport implementation that provides direct method invocation and shared memory communication
  • Server Registry: Static registry that maps server names to server instances for named servers
  • Executor Integration: Support for custom and shared executor services for optimal performance

Capabilities

Channel Building

Create 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);

Channel Building

Server Building

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();

Server Building

Socket Addresses

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();
}

Socket Addresses

Performance Features

  • Zero Network Overhead: Direct method invocation within the same JVM process
  • Message Size Assumptions: Configure assumed message sizes to skip serialization for metrics
  • Executor Service Management: Shared executor pools for optimal resource usage
  • Stats Recording: Optional stats recording that can be disabled for maximum performance

Use Cases

  • Testing: Fast and reliable gRPC interactions in unit and integration tests
  • Microservice Architectures: Efficient communication between components in the same application
  • High-Throughput Systems: Maximum performance scenarios where network latency would be a bottleneck
  • Development: Rapid prototyping and development without network configuration complexity