Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wildfly-extras/wildfly-grpc-feature-pack

WildFly gRPC feature pack
https://github.com/wildfly-extras/wildfly-grpc-feature-pack

feature-pack galleon grpc wildfly

Last synced: 3 months ago
JSON representation

WildFly gRPC feature pack

Awesome Lists containing this project

README

        

# WildFly gRPC

Feature pack to bring gRPC support to WildFly. gRPC services are registered against a gRPC server listening, by default, to port 9555.

Only gRPC services are supported at the moment. Support for gRPC clients is coming soon.

# Get Started

To build the feature pack, simply run

```shell
mvn install
```

This will build everything, and run the testsuite.

Once built you can provision a server with gRPC support using Galleon provisioning. An example using the
`org.wildfly.plugins:wildfly-maven-plugin`:

```xml

org.wildfly.plugins
wildfly-maven-plugin



org.wildfly
wildfly-galleon-pack
${version.wildfly}


org.wildfly.extras.grpc
wildfly-grpc-feature-pack
${version.wildfly.grpc}



core-server
web-server
grpc


${galleon.fork.embedded}

wildfly
${galleon.log.time}
true

```

You can also configure this with the Galleon CLI tool:

```bash
galleon.sh install org.wildfly:wildfly-galleon-pack:$WILDFLY_VERSION --dir=wildfly-grpc
galleon.sh install org.wildfly.extras.grpc:wildfly-grpc-feature-pack:$GRPC_VERSION --dir=wildfly-grpc
```

# Examples

Each example consists of three modules:

1. Proto: Contains the proto definitions
2. Service: Contains the gRPC service
3. Client: Contains a client to call the deployed gRPC service

Before running the examples, please make sure that all necessary dependencies are available in your local maven repository:

```shell
mvn install -P examples
```

## Hello World

The `helloworld` example is a slightly modified version of the `helloworld` example from [gRPC Java examples](https://github.com/grpc/grpc-java/tree/master/examples).

### Service

To build the `helloworld` service, provision a WildFly server with the gRPC subsystem and any necessary certificate files,
and deploy the service, run:

mvn wildfly:run -P examples -pl examples/helloworld/service -Dssl=*SSL*

where *SSL* is either

* none: plaintext
* oneway: server identity is verified
* twoway: both server and client identities are verified

### Client

The `helloworld` client is a simple Java application. To build the client and call to the gRPC service, run:

mvn exec:java -P examples -pl examples/helloworld/client -Dexec.args="Bob *SSL*"

where, again, *SSL* is either "none", "oneway", or "twoway"

Alternatively you could also use tools like [BloomRPC](https://github.com/uw-labs/bloomrpc)
or [gRPCurl](https://github.com/fullstorydev/grpcurl) to invoke the service:

```shell
grpcurl \ # plaintext
-proto examples/helloworld/proto/src/main/proto/helloworld.proto \
-plaintext \
-d '{"name":"Bob"}' \
localhost:9555 helloworld.Greeter/SayHello
```
or
```shell
grpcurl \ # oneway
-proto examples/helloworld/proto/src/main/proto/helloworld.proto \
-cacert examples/helloworld/client/src/main/resources/client.truststore.pem \
-d '{"name":"Bob"}' \
localhost:9555 helloworld.Greeter/SayHello
```
or
```shell
grpcurl \ # twoway
-proto examples/helloworld/proto/src/main/proto/helloworld.proto \
-cacert examples/helloworld/client/src/main/resources/client.truststore.pem \
-cert examples/helloworld/client/src/main/resources/client.keystore.pem \
-key examples/helloworld/client/src/main/resources/client.key.pem \
-d '{"name":"Bob"}' \
localhost:9555 helloworld.Greeter/SayHello
```
**Note.** To use the current versions of the certificate files with grpcurl, it is necessary to set

export GODEBUG=x509ignoreCN=0

This restriction will be removed in the future.

## Chat

The `chat` example is taken from [gRPC by example](https://github.com/saturnism/grpc-by-example-java).

### Service

To build the `chat` service, provision a WildFly server with the gRPC subsystem and any necessary certificate files,
and deploy the service, run:

mvn wildfly:run -P examples -pl examples/chat/service -Dssl=*SSL*

where *SSL* is either

* none: plaintext
* oneway: server identity is verified
* twoway: both server and client identities are verified

### Client

The `chat` client is a JavaFX application. To build the client and connect to the gRPC service, run:

mvn javafx:run -P examples -pl examples/chat/client -Dexec.args="*SSL*"

To see the `chat` example in action, you should start multiple chat clients.

# Licenses

This project uses the following licenses:

* [Apache License 2.0](https://repository.jboss.org/licenses/apache-2.0.txt)