This documentation is not maintained. Please refer to doc.castsoftware.com/technologies to find the latest updates.

Extension ID

com.castsoftware.grpcjava

What's new?

Please see gRPC-java - 1.0 - Release Notes for more information.

Description

This extension provides support for gRPC when used inside Java source code. 

In what situation should you install this extension?

If your JEE application source code uses the gRPC framework you should install this extension  (see gRPC for more information about this framework).

Features

  • Creates gRPC service method objects which represent entry-points to the server.
  • Creates calls to gRPC service method objects which represent exit-points from the client.
  • The dependent Web Services Linker is responsible for detecting and creating links between matching calls to gRPC Method objects and the gRPC Method objects.

Support

Server side

When a class inherits from FooServiceGrpc.FooServiceImplBase, for any overiden method FooMethod the analyzer creates a gRPC Method object named FooService.FooMethod. For instance when analyzing the following source code, the extension creates a Greeter.sayHello gRPC Method and a callLink to the Java Method sayHello.

public class GreeterService extends GreeterGrpc.GreeterImplBase {
    @Override
    public void sayHello(GreeterOuterClass.HelloRequest request, StreamObserver<GreeterOuterClass.HelloReply> responseObserver) {
        String message = "Hello " + request.getName();
        log.info("Returning " +message);
    }
}

Client side

The gRPC frameworks provide stubs for the client side. A gRPC call can be carried out from that stub. When analyzing the following source code, this extension will generate a call to gRPC Method object name Greeter.sayHello

import io.grpc.examples.GreeterGrpc;

public class DemoAPpTest {

  private static final GreeterGrpc.GreeterStub stub = GreeterGrpc.newStub(channel);


  protected void init(VaadinRequest vaadinRequest) {
    try {
      stub.sayHello(GreeterOuterClass.HelloRequest.newBuilder().setName("name").build());
    } catch (StatusRuntimeException e) {
    }      

 Web Services Linker is then responsible for linking that call to gRPC Method to any matching gRPC service method.

Function Point, Quality and Sizing support

This extension provides the following support:

  • Function Points (transactions): a green tick indicates that OMG Function Point counting and Transaction Risk Index are supported
  • Quality and Sizing: no Quality Rules are implemented for gRPC-java

Function Points
(transactions)

Quality and Sizing

(tick)(error)

AIP Core compatibility

AIP Core release

Supported

8.3.x(tick)

Prerequisites

(tick)An installation of any compatible release of AIP Core (see table above)

What source code is needed by our analyzer?

In order to develop an application which uses gRPC one needs to go through the following steps: 

  • write at least one *.proto file. This file is used to define the name of the services and their methods which will be available for remote procedure calls. 
  • use protoc to generate source code (in a chosen language) containing the client and server. This code is generated based on the *.proto files. 
  • define the services and methods available through gRPC by extending the generated server.
  • calls to these methods are carried out using stubs defined in the generated source code.

Our analyzers rely on the naming convention which is used by gRPC for generating the source code based on the *.proto files. Our analyzers do not need the *.proto file nor the generated source code.

If the generated source code has been modified, analyzers will probably not be able to connect gRPC calls from clients to servers.

Dependencies with other extensions

Some CAST extensions require the presence of other CAST extensions in order to function correctly. The extension requires that the following other CAST extensions are also installed:

Note that:

  • any dependent extensions are automatically downloaded and installed for you. You do not need to do anything.
  • the JEE Analyzer is not a dependency, but this extension will be automatically installed when JEE/Java source code is delivered for analysis.

Download and installation instructions

The extension will not be automatically downloaded and installed in CAST Console. If you need to use it, should manually install the extension using the Application - Extensions interface:

What results can you expect?

Objects

The following objects are displayed in CAST Enlighten:

Icon

Description

Java gRPC Service Method 

call to gRPC Service Method 

Current known limitations

  • Only the files which contain an import containing at least one "grpc" string are currently analyzed with this extension. 
  • Cloud endpoints with gRPC is not supported
  • gRPC Cloud Pub/Sub is not supported
  • Multi-line method call are not supported for the creation of calls to gRPC service method. No call to gRPC service can be created from the following code:

stub
   .foo()