kandi background
Explore Kits

grpc-java | The Java gRPC implementation. HTTP/2 based RPC

 by   grpc Java Version: v1.45.1 License: Apache-2.0

 by   grpc Java Version: v1.45.1 License: Apache-2.0

Download this library from

kandi X-RAY | grpc-java Summary

grpc-java is a Java library typically used in Web Services applications. grpc-java has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has high support. You can download it from GitHub, Maven.
gRPC-Java works with JDK 8. gRPC-Java clients are supported on Android API levels 19 and up (KitKat and later). Deploying gRPC servers on an Android device is not supported. TLS usage typically requires using Java 8, or Play Services Dynamic Security Provider on Android. Please see the [Security Readme](SECURITY.md). <table> <tr> <td><b>Homepage:</b></td> <td><a href="https://grpc.io/">grpc.io</a></td> </tr> <tr> <td><b>Mailing List:</b></td> <td><a href="https://groups.google.com/forum/#!forum/grpc-io">grpc-io@googlegroups.com</a></td> </tr> </table>. [![Join the chat at https://gitter.im/grpc/grpc](https://badges.gitter.im/grpc/grpc.svg)](https://gitter.im/grpc/grpc?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/grpc/grpc-java.svg?branch=master)](https://travis-ci.org/grpc/grpc-java) [![Line Coverage Status](https://coveralls.io/repos/grpc/grpc-java/badge.svg?branch=master&service=github)](https://coveralls.io/github/grpc/grpc-java?branch=master) [![Branch-adjusted Line Coverage Status](https://codecov.io/gh/grpc/grpc-java/branch/master/graph/badge.svg)](https://codecov.io/gh/grpc/grpc-java).
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • grpc-java has a highly active ecosystem.
  • It has 9609 star(s) with 3313 fork(s). There are 534 watchers for this library.
  • There were 3 major release(s) in the last 6 months.
  • There are 458 open issues and 2403 have been closed. On average issues are closed in 78 days. There are 65 open pull requests and 0 closed requests.
  • It has a negative sentiment in the developer community.
  • The latest version of grpc-java is v1.45.1
grpc-java Support
Best in #Java
Average in #Java
grpc-java Support
Best in #Java
Average in #Java

quality kandi Quality

  • grpc-java has 0 bugs and 0 code smells.
grpc-java Quality
Best in #Java
Average in #Java
grpc-java Quality
Best in #Java
Average in #Java

securitySecurity

  • grpc-java has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • grpc-java code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
grpc-java Security
Best in #Java
Average in #Java
grpc-java Security
Best in #Java
Average in #Java

license License

  • grpc-java is licensed under the Apache-2.0 License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
grpc-java License
Best in #Java
Average in #Java
grpc-java License
Best in #Java
Average in #Java

buildReuse

  • grpc-java releases are available to install and integrate.
  • Deployable package is available in Maven.
  • Build file is available. You can build the component from source.
  • Installation instructions, examples and code snippets are available.
  • It has 210540 lines of code, 16206 functions and 1207 files.
  • It has medium code complexity. Code complexity directly impacts maintainability of the code.
grpc-java Reuse
Best in #Java
Average in #Java
grpc-java Reuse
Best in #Java
Average in #Java
Top functions reviewed by kandi - BETA

kandi has reviewed grpc-java and discovered the below as its top functions. This is intended to give you an instant insight into grpc-java implemented functionality, and help decide if they suit your requirements.

  • Sets up the benchmark .
  • Tries to find the platform .
  • Starts the stream .
  • Parses the given cluster into a structurally aggregated cluster .
  • Builds a ClientInterceptor .
  • Update the server list .
  • Intercept a server call .
  • Verify host name and pattern .
  • Creates a new ManagedChannelServiceConfig from the given service config .
  • Get all cluster stats for a cluster .

grpc-java Key Features

The Java gRPC implementation. HTTP/2 based RPC

Download

copy iconCopydownload iconDownload
&lt;dependency&gt;
  &lt;groupId&gt;io.grpc&lt;/groupId&gt;
  &lt;artifactId&gt;grpc-netty-shaded&lt;/artifactId&gt;
  &lt;version&gt;1.44.1&lt;/version&gt;
  &lt;scope&gt;runtime&lt;/scope&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
  &lt;groupId&gt;io.grpc&lt;/groupId&gt;
  &lt;artifactId&gt;grpc-protobuf&lt;/artifactId&gt;
  &lt;version&gt;1.44.1&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
  &lt;groupId&gt;io.grpc&lt;/groupId&gt;
  &lt;artifactId&gt;grpc-stub&lt;/artifactId&gt;
  &lt;version&gt;1.44.1&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt; &lt;!-- necessary for Java 9+ --&gt;
  &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
  &lt;artifactId&gt;annotations-api&lt;/artifactId&gt;
  &lt;version&gt;6.0.53&lt;/version&gt;
  &lt;scope&gt;provided&lt;/scope&gt;
&lt;/dependency&gt;

Generated Code

copy iconCopydownload iconDownload
&lt;build&gt;
  &lt;extensions&gt;
    &lt;extension&gt;
      &lt;groupId&gt;kr.motd.maven&lt;/groupId&gt;
      &lt;artifactId&gt;os-maven-plugin&lt;/artifactId&gt;
      &lt;version&gt;1.6.2&lt;/version&gt;
    &lt;/extension&gt;
  &lt;/extensions&gt;
  &lt;plugins&gt;
    &lt;plugin&gt;
      &lt;groupId&gt;org.xolstice.maven.plugins&lt;/groupId&gt;
      &lt;artifactId&gt;protobuf-maven-plugin&lt;/artifactId&gt;
      &lt;version&gt;0.6.1&lt;/version&gt;
      &lt;configuration&gt;
        &lt;protocArtifact&gt;com.google.protobuf:protoc:3.19.2:exe:${os.detected.classifier}&lt;/protocArtifact&gt;
        &lt;pluginId&gt;grpc-java&lt;/pluginId&gt;
        &lt;pluginArtifact&gt;io.grpc:protoc-gen-grpc-java:1.44.1:exe:${os.detected.classifier}&lt;/pluginArtifact&gt;
      &lt;/configuration&gt;
      &lt;executions&gt;
        &lt;execution&gt;
          &lt;goals&gt;
            &lt;goal&gt;compile&lt;/goal&gt;
            &lt;goal&gt;compile-custom&lt;/goal&gt;
          &lt;/goals&gt;
        &lt;/execution&gt;
      &lt;/executions&gt;
    &lt;/plugin&gt;
  &lt;/plugins&gt;
&lt;/build&gt;

protoc: import in service.proto not resolved

copy iconCopydownload iconDownload
package com.tyntec.hades.v1;
package tyntec.hades.v1;
protoc -I. [your_other_options] *.proto
rpc Asc(tyntec.hades.v1.AscIndication) returns (tyntec.hades.v1.AscResponse) {}
-----------------------
package com.tyntec.hades.v1;
package tyntec.hades.v1;
protoc -I. [your_other_options] *.proto
rpc Asc(tyntec.hades.v1.AscIndication) returns (tyntec.hades.v1.AscResponse) {}
-----------------------
package com.tyntec.hades.v1;
package tyntec.hades.v1;
protoc -I. [your_other_options] *.proto
rpc Asc(tyntec.hades.v1.AscIndication) returns (tyntec.hades.v1.AscResponse) {}
-----------------------
package com.tyntec.hades.v1;
package tyntec.hades.v1;
protoc -I. [your_other_options] *.proto
rpc Asc(tyntec.hades.v1.AscIndication) returns (tyntec.hades.v1.AscResponse) {}

Grpc protoc configuration cannot upgrade to latest version with gradle 7.0 but possible in gradle 4.2

copy iconCopydownload iconDownload
protobuf {
    protoc { artifact = 'com.google.protobuf:protoc:3.12.0' }
    plugins {
        grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.36.0' // CURRENT_GRPC_VERSION
        }
    }
    generateProtoTasks {
        all().each { task ->
            task.builtins {
                java { option 'lite' }
            }
            task.plugins {
                grpc { // Options added to --grpc_out
                    option 'lite' }
            }
        }
    }
}

How to set to not print out DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler.log for google log?

copy iconCopydownload iconDownload
<logger name="io.grpc.netty.shaded.io.grpc.netty" level="info">
    <appender-ref ref="STDOUT" />
    <appender-ref ref="CLOUD" />
</logger>

Why JavaMailSender - starttls does not work

copy iconCopydownload iconDownload
  mail:
    properties:
      smtp:
        auth: true
        starttls:
          enable: true
  mail:
    properties:
      mail:
        smtp:
          auth: true
          starttls:
            enable: true
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
-----------------------
  mail:
    properties:
      smtp:
        auth: true
        starttls:
          enable: true
  mail:
    properties:
      mail:
        smtp:
          auth: true
          starttls:
            enable: true
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
-----------------------
  mail:
    properties:
      smtp:
        auth: true
        starttls:
          enable: true
  mail:
    properties:
      mail:
        smtp:
          auth: true
          starttls:
            enable: true
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true

Grpc-java multiple channel management

copy iconCopydownload iconDownload
 ManagedChannelBuilder.forAddress("127.0.0.1", 9091)
                      .executor(Executors.newCachedThreadPool())
                      .usePlaintext()
                      .build()

How to generate java stubs from protobuf for Java target 11 using maven?

copy iconCopydownload iconDownload
<dependency> <!-- necessary for Java 9+ -->
  <groupId>org.apache.tomcat</groupId>
  <artifactId>annotations-api</artifactId>
  <version>6.0.53</version>
  <scope>provided</scope>
</dependency>

gRPC java spring server &quot;error&quot;: &quot;2 UNKNOWN: Stream removed&quot;

copy iconCopydownload iconDownload
## Server Properties
server:
  port: 6789
  compression.enabled: true
  max-http-header-size: 20000

grpc:
  port: 6790

gRPC code not being generated from proto file

copy iconCopydownload iconDownload
import com.google.protobuf.gradle.*

plugins {
    java
    idea
    application
    id("com.google.protobuf") version "0.8.14"
    id("io.freefair.lombok") version "5.3.0"
}

repositories {
    mavenCentral()
    jcenter()
}


val grpcVersion = "1.34.1"
val protocVersion = "3.12.0"
val slf4jVersion = "1.7.25"

dependencies {
    implementation("io.grpc:grpc-netty:${grpcVersion}")
    implementation("io.grpc:grpc-protobuf:${grpcVersion}")
    implementation("io.grpc:grpc-stub:${grpcVersion}")
    implementation("org.slf4j:slf4j-api:${slf4jVersion}")
    implementation("org.slf4j:slf4j-simple:${slf4jVersion}")

    testImplementation("junit:junit:4.13")
}

// Look here for set path
sourceSets {
    main {
        proto {
            srcDir("src/main/resources/proto")
        }
    }
}

protobuf {
    protoc { artifact = "com.google.protobuf:protoc:${protocVersion}" }
    plugins {
        id("grpc") {
            artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
        }
    }
    generateProtoTasks {
        ofSourceSet("main").forEach {
            it.plugins {
                id("grpc")
            }
        }
    }
}

ERROR: PROTOC FAILED: google/protobuf/wrappers.proto: File not found. (Error in Maven build)

copy iconCopydownload iconDownload
<dependencies>
    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java</artifactId>
      <version>3.5.1-1</version>
    </dependency>
    ...
  </dependencies>
<build>
  <extensions>
    <extension>
      <groupId>kr.motd.maven</groupId>
      <artifactId>os-maven-plugin</artifactId>
      <version>1.5.0.Final</version>
    </extension>
  </extensions>
  <plugins>
    <plugin>
      <groupId>org.xolstice.maven.plugins</groupId>
      <artifactId>protobuf-maven-plugin</artifactId>
      <version>0.5.1</version>
      <extensions>true</extensions>
      <configuration>
        <protocArtifact>com.google.protobuf:protoc:3.5.1-1:exe:${os.detected.classifier}</protocArtifact>
      </configuration>
      <executions>
        <execution>
          <goals>
            <goal>compile</goal>
            <goal>test-compile</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>
-----------------------
<dependencies>
    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java</artifactId>
      <version>3.5.1-1</version>
    </dependency>
    ...
  </dependencies>
<build>
  <extensions>
    <extension>
      <groupId>kr.motd.maven</groupId>
      <artifactId>os-maven-plugin</artifactId>
      <version>1.5.0.Final</version>
    </extension>
  </extensions>
  <plugins>
    <plugin>
      <groupId>org.xolstice.maven.plugins</groupId>
      <artifactId>protobuf-maven-plugin</artifactId>
      <version>0.5.1</version>
      <extensions>true</extensions>
      <configuration>
        <protocArtifact>com.google.protobuf:protoc:3.5.1-1:exe:${os.detected.classifier}</protocArtifact>
      </configuration>
      <executions>
        <execution>
          <goals>
            <goal>compile</goal>
            <goal>test-compile</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>
-----------------------
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.practice</groupId>
<artifactId>OrderManagement-gRPC</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<grpc.version>1.35.0</grpc.version>
<protoc.version>3.4.0</protoc.version>
    <encoding>UTF-8</encoding>
</properties>


<dependencies>
    <dependency>
        <groupId>com.google.protobuf</groupId>
        <artifactId>protobuf-java</artifactId>
        <version>${protoc.version}</version>
    </dependency>
    <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-netty-shaded</artifactId>
        <version>${grpc.version}</version>
    </dependency>
    <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-protobuf</artifactId>
        <version>${grpc.version}</version>
    </dependency>
    <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-stub</artifactId>
        <version>${grpc.version}</version>
    </dependency>
</dependencies>


<build>
    <extensions>
        <extension>
            <groupId>kr.motd.maven</groupId>
            <artifactId>os-maven-plugin</artifactId>
            <version>1.6.2</version>
        </extension>
    </extensions>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.1</version>
            <executions>
                <execution>
                    <phase>validate</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <tasks>
                            <echo>Displaying 1 environment variables</echo>
                            <echo>[Path] ${env.PATH}</echo>
                            <echo>[os.detected.classifier] ${os.detected.classifier}</echo>
                        </tasks>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.xolstice.maven.plugins</groupId>
            <artifactId>protobuf-maven-plugin</artifactId>
            <version>0.6.1</version>
            <configuration>
                <!--suppress UnresolvedMavenProperty -->
                <protocArtifact>com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier}</protocArtifact>
                <pluginId>grpc-java</pluginId>
                <pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact> </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                        <goal>compile-custom</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>

      
    </plugins>
</build>

How to create a start script for the example gRPC Java TLS server/client?

copy iconCopydownload iconDownload
❯ git checkout v1.35.0
❯ cd examples/example-tls
❯ ../gradlew installDist
❯ tree build/install/example-tls/bin
build/install/example-tls/bin
├── hello-world-tls-client
├── hello-world-tls-client.bat
├── hello-world-tls-server
└── hello-world-tls-server.bat
-----------------------
❯ git checkout v1.35.0
❯ cd examples/example-tls
❯ ../gradlew installDist
❯ tree build/install/example-tls/bin
build/install/example-tls/bin
├── hello-world-tls-client
├── hello-world-tls-client.bat
├── hello-world-tls-server
└── hello-world-tls-server.bat

Community Discussions

Trending Discussions on grpc-java
  • protoc: import in service.proto not resolved
  • How to access gRPC server in matlab?
  • Grpc protoc configuration cannot upgrade to latest version with gradle 7.0 but possible in gradle 4.2
  • In GRPC, how to selectively require Client Certificate for a few services but not require it for other services?
  • How to set to not print out DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler.log for google log?
  • Why JavaMailSender - starttls does not work
  • how implement health check in the grpc-dart implementation?
  • why do I not find generated source files for grpc and protobuf when using maven and java in vscode
  • Grpc-java multiple channel management
  • How to generate java stubs from protobuf for Java target 11 using maven?
Trending Discussions on grpc-java

QUESTION

protoc: import in service.proto not resolved

Asked 2022-Mar-17 at 08:25

I have a project where the service definition is in a separate file form the message definition. protoc doesn't like this:

Execution failed for task ':generateProto'.
> protoc: stdout: . stderr: IAscIndication.proto:11:13: "AscIndication" is not defined.
  IAscIndication.proto:11:37: "AscResponse" is not defined.

(protoc is called from gradle).

Is this something one shouldn't do or a problem in our setup or a bug in protoc (3.19.4)? It works when I combine both files in one.

The files in question:

IAscIndication.proto

syntax = "proto3";

import "Asc.proto";

package com.tyntec.hades.v1;
option java_multiple_files = true;
option java_package = "com.tyntec.hades.grpc";

service IAscIndication
{
    rpc Asc(AscIndication) returns (AscResponse) {}
}

Asc.proto

syntax = "proto3";

import "BaseTypes.proto";

package tyntec.hades.v1;
option java_multiple_files = true;
option java_package = "com.tyntec.hades.grpc";

message AscRequest
{
    SignalOutbound      meta            = 1;
    AscRequestData      data            = 2;
}

message AscIndication
{
    SignalInbound       meta            = 1;
    AscRequestData      data            = 2;
}

And here is the cmdline and error when called from bash:

> /home/martinsc/.gradle/caches/modules-2/files-2.1/com.google.protobuf/protoc/3.19.4/99ed7588824cb00e0db4f1b215e7d4c69d00e74b/protoc-3.19.4-linux-x86_64.exe -I/home/martinsc/java/mt/acheron/src/main/proto -I/home/martinsc/java/mt/acheron/build/extracted-protos/main -I/home/martinsc/java/mt/acheron/build/extracted-include-protos/main --java_out=/home/martinsc/java/mt/acheron/src/generated/main/java --plugin=protoc-gen-grpc=/home/martinsc/.gradle/caches/modules-2/files-2.1/io.grpc/protoc-gen-grpc-java/1.44.1/5d42eec0c997038e3a131dea05ad9f5be37992cb/protoc-gen-grpc-java-1.44.1-linux-x86_64.exe --grpc_out=/home/martinsc/java/mt/acheron/src/generated/main/grpc /home/martinsc/java/mt/acheron/src/main/proto/Asc.proto /home/martinsc/java/mt/acheron/src/main/proto/BaseTypes.proto /home/martinsc/java/mt/acheron/src/main/proto/Error.proto /home/martinsc/java/mt/acheron/src/main/proto/IAscIndication.proto
IAscIndication.proto:11:13: "AscIndication" is not defined.
IAscIndication.proto:11:37: "AscResponse" is not defined.

System is Ubuntu 20.4.

ANSWER

Answered 2022-Mar-17 at 08:25

This is due to the package that doesn't match (probably a typo). In order to include another file they either need to be in the same package or you need to use the -I option in protoc.

So in your case you probably need to change you Asc.proto package to :

package com.tyntec.hades.v1;

or change your IAscIndication.proto one to:

package tyntec.hades.v1;

If you do not want to change the packages, you have two possibilities:

  • try to run protoc like this:
protoc -I. [your_other_options] *.proto
  • use the fully qualified name in the rpc endpoint
rpc Asc(tyntec.hades.v1.AscIndication) returns (tyntec.hades.v1.AscResponse) {}

Source https://stackoverflow.com/questions/71439311

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install grpc-java

For a guided tour, take a look at the [quick start guide](https://grpc.io/docs/languages/java/quickstart) or the more explanatory [gRPC basics](https://grpc.io/docs/languages/java/basics). The [examples](https://github.com/grpc/grpc-java/tree/v1.44.1/examples) and the [Android example](https://github.com/grpc/grpc-java/tree/v1.44.1/examples/android) are standalone projects that showcase the usage of gRPC.
Download [the JARs][]. Or for Maven with non-Android, add to your pom.xml:.
If you are making changes to gRPC-Java, see the [compiling instructions](COMPILING.md).

Support

For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Explore Related Topics

Share this Page

share link
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.