{"id":13805971,"url":"https://github.com/msteinhoff/dropwizard-grpc","last_synced_at":"2025-05-13T21:31:56.897Z","repository":{"id":57734245,"uuid":"60859792","full_name":"msteinhoff/dropwizard-grpc","owner":"msteinhoff","description":"A set of classes to use a gRPC server in a Dropwizard service.","archived":true,"fork":false,"pushed_at":"2021-05-03T20:02:59.000Z","size":254,"stargazers_count":25,"open_issues_count":6,"forks_count":9,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-08-04T01:05:41.670Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://msteinhoff.github.io/dropwizard-grpc/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/msteinhoff.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-10T15:54:07.000Z","updated_at":"2024-03-18T08:44:21.000Z","dependencies_parsed_at":"2022-09-26T22:10:59.944Z","dependency_job_id":null,"html_url":"https://github.com/msteinhoff/dropwizard-grpc","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msteinhoff%2Fdropwizard-grpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msteinhoff%2Fdropwizard-grpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msteinhoff%2Fdropwizard-grpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msteinhoff%2Fdropwizard-grpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/msteinhoff","download_url":"https://codeload.github.com/msteinhoff/dropwizard-grpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225260368,"owners_count":17446085,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T01:01:06.727Z","updated_at":"2024-11-18T22:31:03.524Z","avatar_url":"https://github.com/msteinhoff.png","language":"Java","readme":"# Dropwizard gRPC\n\n**⚠️ THIS PROJECT IS NOT MAINTAINED ANYMORE. ⚠️**\n\n[![Build Status](https://travis-ci.org/msteinhoff/dropwizard-grpc.svg?branch=master)](https://travis-ci.org/msteinhoff/dropwizard-grpc)\n[![Coverage Status](https://img.shields.io/coveralls/msteinhoff/dropwizard-grpc.svg)](https://coveralls.io/r/msteinhoff/dropwizard-grpc)\n[![Bintray](https://img.shields.io/bintray/v/msteinhoff/maven/dropwizard-grpc.svg)](https://bintray.com/msteinhoff/maven/dropwizard-grpc/1.2.3-2)\n[![Maven Central](https://img.shields.io/maven-central/v/io.github.msteinhoff/dropwizard-grpc.svg)](http://search.maven.org/#artifactdetails%7Cio.github.msteinhoff%7Cdropwizard-grpc%7C1.2.3-2%7C)\n[![Javadocs](http://www.javadoc.io/badge/io.github.msteinhoff/dropwizard-grpc.svg)](http://www.javadoc.io/doc/io.github.msteinhoff/dropwizard-grpc/1.2.3-2)\n\nA set of classes to use [gRPC](1) server in a [Dropwizard](2) application.  \n\nThe package provides [lifecycle-management](3) and configuration factory\nclasses with the most common options for gRPC `Server` and `ManagedChannel`\nclasses.  \n\n# Server\n\nTo embed a grpc server, add a `GrpcServerFactory` to your [Configuration](4)\nclass.  This enables configuration of the grpc server port and transport\nsecurity files.  \n\n**ExampleServiceConfiguration.java**:  \n\n```java\nclass ExampleServiceConfiguration extends Configuration {\n    @Valid\n    @NotNull\n    private GrpcServerFactory grpcServer = new GrpcServerFactory();\n\n    @JsonProperty(\"grpcServer\")\n    public GrpcServerFactory getGrpcServerFactory() {\n        return grpcServer;\n    }\n\n    @JsonProperty(\"grpcServer\")\n    public void setGrpcServerFactory(final GrpcServerFactory grpcServer) {\n        this.grpcServer = grpcServer;\n    }\n}\n```\n\nThe following configuration settings are supported by `GrpcServerFactory`:  \n\n* `port`: Port number the gRPC server should bind on\n* `shutdownDuration`: How long to wait before giving up when the server is shutdown\n* `certChainFile`: (Optional) Path to the certificate chain file when TLS should be used\n* `privateKeyFile`: (Optional) Path to the private key file when TLS should be used\n\n**example-service.yml:**\n\n```yaml\nserver:\n    [...]\nlogging:\n    [...]\ngrpcServer:\n    port: 8000\n    shutdownDuration: 10 seconds\n```\n\nIn dropwizard's run method, use the `GrpcServerFactory` class to create a gRPC\n`Server` instance.  The `GrpcServerFactory` provides a `ServerBuilder` via\n`builder()` to configure the Server instance, e.g. to add a custom executor or\nto add gRPC service classes.  The created server instance is also automatically\nadded to the dropwizard lifecycle.  \n\n**ExampleServiceApplication.java**:  \n\n```java\nclass ExampleServiceApplication extends Application\u003cExampleServiceConfiguration\u003e {\n    [...]\n\n    @Override\n    public void run(final ExampleServiceConfiguration configuration, final Environment environment) throws IOException {\n        final Server grpcServer;\n        grpcServer = configuration.getGrpcServerFactory()\n                .builder(environment)\n                .addService(new ExampleService())\n                .build();\n    }\n\n    [...]\n}\n```\n\n# Client\n\nTo embed a grpc channel for a server, add a `GrpcChannelFactory` to your\n[Configuration](4) class.  This enables configuration of the grpc channel\nhostname and port.\n\n**ExampleServiceConfiguration.java**:  \n\n```java\nclass ExampleServiceConfiguration extends Configuration {\n    @Valid\n    @NotNull\n    private GrpcChannelFactory externalService = new GrpcChannelFactory();\n\n    @JsonProperty(\"externalService\")\n    public GrpcChannelFactory getExternalGrpcChannelFactory() {\n        return externalService;\n    }\n\n    @JsonProperty(\"externalService\")\n    public void setExternalGrpcChannelFactory(final GrpcChannelFactory externalService) {\n        this.externalService = externalService;\n    }   \n\n}\n```\n\nThe following configuration settings are supported by `GrpcChannelFactory`:\n\n* `hostname`: Hostname of the gRPC server to connect to\n* `port`: Port of the gRPC server to connect to\n* `shutdownDuration`: How long to wait before giving up when the channel is\nshutdown\n\n**example-service.yml:**\n\n```yaml\nserver:\n    [...]\nlogging:\n    [...]\nexternalService:\n    hostname: hostname.example.org\n    port: 8000\n    shutdownDuration: 10 seconds\n```\n\nIn dropwizard's run method, use the `GrpcChannelFactory` class to create a gRPC\n`ManagedChannel` instance.   The created channel instance is also automatically\nadded to the dropwizard lifecycle.  The returned `ManagedChannel` instance can\nbe used by other application components to send requests to the given server.  \n\n**ExampleServiceApplication.java**:  \n\n```java\nclass ExampleServiceApplication extends Application\u003cExampleServiceConfiguration\u003e {\n    [...]\n\n    @Override\n    public void run(final ExampleServiceConfiguration configuration, final Environment environment) throws IOException {\n        final ManagedChannel externalServiceChannel;\n        externalServiceChannel = configuration.getExternalGrpcChannelFactory()\n                .build(environment);\n\n        // use externalServiceChannel\n    }\n\n    [...]\n}\n```\n\n# Artifacts\n\nThis project is available on JCenter and Maven Central.  To add it to your\nproject simply add the following dependency to your pom.xml:\n\n    \u003cdependency\u003e\n      \u003cgroupId\u003eio.github.msteinhoff\u003c/groupId\u003e\n      \u003cartifactId\u003edropwizard-grpc\u003c/artifactId\u003e\n      \u003cversion\u003e1.2.3-2\u003c/version\u003e\n    \u003c/dependency\u003e\n\nOr if you are using gradle:\n\n    repositories {\n        jcenter()\n    }\n\n    dependencies {\n        compile 'io.github.msteinhoff:dropwizard-grpc:1.2.3-2'\n    }\n\n# Support\n\nPlease file bug reports and feature requests in [GitHub issues](5).  \n\n# License\n\nCopyright (c) 2016-2018 Mario Steinhoff\n\nThis library is licensed under the Apache License, Version 2.0.\n\nSee http://www.apache.org/licenses/LICENSE-2.0.html or the LICENSE file in this\nrepository for the full license text.  \n\n[1]: https://www.grpc.io/\n[2]: http://dropwizard.io/1.1.3/docs/\n[3]: http://dropwizard.io/1.1.3/docs/manual/core.html#managed-objects\n[4]: http://dropwizard.io/1.1.3/docs/manual/core.html#configuration\n[5]: https://github.com/msteinhoff/dropwizard-grpc/issues/\n","funding_links":[],"categories":["Open Source"],"sub_categories":["Eclipse"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsteinhoff%2Fdropwizard-grpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsteinhoff%2Fdropwizard-grpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsteinhoff%2Fdropwizard-grpc/lists"}