Visit Azul.com Support

Grpc

Table of Contents
Need help?
Schedule a consultation with an Azul performance expert.
Contact Us

What Is Grpc?

gRPC is a modern open-source high performance Remote Procedure Call (RPC) framework that uses HTTP/2 and simplifies the communication with protocol buffers to share data between client and server. By enabling gRPC, Payara Server gives more options to create binary-compatible services. gRPC comes bundled with Azul Payara Server and can be used to create gRPC services in your web applications.

What Can We Do with It?

  • Create services more efficient than REST.

  • Use HTTP/2 to provide full duplex communication between the client and the service.

  • Use protocol buffers to optimize and simplify communication.

  • Enable bidirectional streaming out-of-the-box.

Availability

gRPC support is bundled with Azul Payara Server, Azul Payara Micro, and the Azul Payara Embedded distributions. No separate installation is required. The grpc-support.jar module is automatically included in glassfish/modules.

Important
If you are upgrading from an earlier release where gRPC Support had to be installed manually into ${PAYARA_HOME}/glassfish/modules, remove any manually installed grpc-support JAR to avoid conflicts with the bundled module.

How It Works

When a WAR application is deployed, Payara Server automatically detects whether it contains a gRPC service by scanning for implementations of io.grpc.BindableService. If detected, the server registers a servlet filter that routes all application/grpc HTTP/2 requests to the appropriate service implementation via CDI.

Application Dependencies

Applications that implement gRPC services should declare the gRPC and Protocol Buffers dependencies with provided scope, since the runtime is supplied by the server.

Use the Azul Payara BOM so that these versions match the ones bundled with the server, rather than hardcoding them:

 
<dependencyManagement> <dependencies> <dependency> <groupId>fish.payara.api</groupId> <artifactId>payara-bom</artifactId> <version>{page-version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>

With the BOM imported, declare the dependencies without explicit versions:

 
<dependency> <groupId>io.grpc</groupId> <artifactId>grpc-api</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>io.grpc</groupId> <artifactId>grpc-stub</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>io.grpc</groupId> <artifactId>grpc-protobuf</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>com.google.protobuf</groupId> <artifactId>protobuf-java</artifactId> <scope>provided</scope> </dependency>
Note
Do not bundle gRPC or Protobuf JARs inside your WAR. Declaring them as provided ensures the server’s bundled version is used at runtime, avoiding classpath conflicts.