-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
blog post: Using the resteasy-grpc feature together with the WildFly … #129
Conversation
I'll give this a read and follow the instructions, hopefully, a little later today. |
@jamezp Thanks! |
Heyyy @liweinan, I'm so happy!! You have resteasy-grpc number 1!! [See https://en.wikipedia.org/wiki/Erd%C5%91s_number] :) Here are a couple of notes:
to something like
Well done!! Thank you!! |
@ronsigal Thanks for the praising ! I'll modify the contents as you suggested :D |
_posts/2023-08-08-resteasy-grpc.md
Outdated
```bash | ||
$ mvn archetype:generate -B \ | ||
-DarchetypeGroupId=dev.resteasy.grpc \ | ||
-DarchetypeArtifactId=gRPCtoJakartaREST-archetype \ | ||
-DarchetypeVersion=1.0.0.Alpha5 \ | ||
-DgroupId=dev.resteasy.examples \ | ||
-DartifactId=grpcToRest.example \ | ||
-Dversion=1.0.1.Final-SNAPSHOT \ | ||
-Dgenerate-prefix=Greet \ | ||
-Dgenerate-package=org.greet \ | ||
-Dresteasy-version=6.2.4.Final \ | ||
-Dgrpc-bridge-version=1.0.0.Alpha2 | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not work for me. I see this:
[INFO] Scanning for projects...
[INFO]
[INFO] --------------< dev.resteasy.examples:grpcToRest.example >--------------
[INFO] Building gRPC to Jakarta REST example 1.0.1.Final-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] >>> archetype:3.1.2:generate (default-cli) > generate-sources @ grpcToRest.example >>>
[INFO]
[INFO] --- enforcer:3.0.0-M3:enforce (enforce-java-version) @ grpcToRest.example ---
[INFO]
[INFO] --- enforcer:3.0.0-M3:enforce (enforce-maven-version) @ grpcToRest.example ---
[INFO]
[INFO] --- buildnumber:1.4:create (get-scm-revision) @ grpcToRest.example ---
[INFO] Executing: /bin/sh -c cd '/home/jperkins/projects/resteasy/resteasy-examples/grpc-bridge-example' && 'git' 'rev-parse' '--verify' 'HEAD'
[INFO] Working directory: /home/jperkins/projects/resteasy/resteasy-examples/grpc-bridge-example
[INFO] Storing buildNumber: d14fb2264adacc704b20a5d9f3d709fc74ab5e35 at timestamp: 1691610063655
[INFO] Storing buildScmBranch: main
[INFO]
[INFO] <<< archetype:3.1.2:generate (default-cli) < generate-sources @ grpcToRest.example <<<
[INFO]
[INFO]
[INFO] --- archetype:3.1.2:generate (default-cli) @ grpcToRest.example ---
[INFO] Generating project in Batch mode
[INFO] Archetype repository not defined. Using the one from [dev.resteasy.grpc:gRPCtoJakartaREST-archetype:1.0.0.Alpha5] found in catalog remote
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: gRPCtoJakartaREST-archetype:1.0.0.Alpha5
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: dev.resteasy.examples
[INFO] Parameter: artifactId, Value: grpcToRest.example
[INFO] Parameter: version, Value: 1.0.1.Final-SNAPSHOT
[INFO] Parameter: package, Value: dev.resteasy.examples
[INFO] Parameter: packageInPathFormat, Value: dev/resteasy/examples
[INFO] Parameter: package, Value: dev.resteasy.examples
[INFO] Parameter: resteasy-version, Value: 6.2.4.Final
[INFO] Parameter: generate-prefix, Value: Greet
[INFO] Parameter: groupId, Value: dev.resteasy.examples
[INFO] Parameter: artifactId, Value: grpcToRest.example
[INFO] Parameter: grpc-bridge-version, Value: 1.0.0.Alpha2
[INFO] Parameter: generate-package, Value: org.greet
[INFO] Parameter: version, Value: 1.0.1.Final-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.057 s
[INFO] Finished at: 2023-08-09T12:41:07-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.1.2:generate (default-cli) on project grpcToRest.example: Unable to add module to the current project as it is not of packaging type 'pom' -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
I think the -Dgenerate-package=org.greet
needs to be changed to -Dgenerate-package=dev.resteasy.examples.grpc.greet
. However, if I do that it just hangs and fails with the same error.
It does create a new grpcToRest.example
directory with a pom.xml
file, but I'm not sure what to do with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jamezp From the output it seems you are running the above command inside the grpc-bridge-example
project directory:
[INFO] Executing: /bin/sh -c cd '/home/jperkins/projects/resteasy/resteasy-examples/grpc-bridge-example' && 'git' 'rev-parse' '--verify' 'HEAD'
[INFO] Working directory: /home/jperkins/projects/resteasy/resteasy-examples/grpc-bridge-example
Actually the command should be run in an empty directory:
weli@192:~/w/play-grpc
➤ mvn archetype:generate -B \ 22:51:57
-DarchetypeGroupId=dev.resteasy.grpc \
-DarchetypeArtifactId=gRPCtoJakartaREST-archetype \
-DarchetypeVersion=1.0.0.Alpha5 \
-DgroupId=dev.resteasy.examples \
-DartifactId=grpcToRest.example \
-Dversion=1.0.1.Final-SNAPSHOT \
-Dgenerate-prefix=Greet \
-Dgenerate-package=org.greet \
-Dresteasy-version=6.2.4.Final \
-Dgrpc-bridge-version=1.0.0.Alpha2
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:3.2.1:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:3.2.1:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO]
[INFO]
[INFO] --- maven-archetype-plugin:3.2.1:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Batch mode
[INFO] Archetype repository not defined. Using the one from [dev.resteasy.grpc:gRPCtoJakartaREST-archetype:1.0.0.Alpha5] found in catalog remote
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: gRPCtoJakartaREST-archetype:1.0.0.Alpha5
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: dev.resteasy.examples
[INFO] Parameter: artifactId, Value: grpcToRest.example
[INFO] Parameter: version, Value: 1.0.1.Final-SNAPSHOT
[INFO] Parameter: package, Value: dev.resteasy.examples
[INFO] Parameter: packageInPathFormat, Value: dev/resteasy/examples
[INFO] Parameter: package, Value: dev.resteasy.examples
[INFO] Parameter: resteasy-version, Value: 6.2.4.Final
[INFO] Parameter: generate-prefix, Value: Greet
[INFO] Parameter: groupId, Value: dev.resteasy.examples
[INFO] Parameter: artifactId, Value: grpcToRest.example
[INFO] Parameter: grpc-bridge-version, Value: 1.0.0.Alpha2
[INFO] Parameter: generate-package, Value: org.greet
[INFO] Parameter: version, Value: 1.0.1.Final-SNAPSHOT
[INFO] Project created from Archetype in dir: /Users/weli/works/play-grpc/grpcToRest.example
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.775 s
[INFO] Finished at: 2023-08-10T22:52:11+08:00
[INFO] ------------------------------------------------------------------------
weli@192:~/w/play-grpc
And in this empty directory the bridge project is generated:
weli@192:~/w/play-grpc
➤ ls -G 22:52:11
grpcToRest.example
I guess this part of text is not clear on this point, and I'll add some notes to the blog post.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. Yeah, that definitely was clear to me. I'll try this again later today and report back.
FWIW if we do need to run this in a separate project and copy things around, that's not great UX. We should really focus on fixing that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes currently the design is that the archetype
project copies the Java classes from the "source project" into the "bridge project" via the maven-dependency-plugin
(https://github.com/resteasy/gRPCtoJakartaREST-archetype/blob/main/src/main/resources/archetype-resources/pom.xml#L189), and then the resteasy-grpc
do the rest of the processing and generation work inside the "bridge project".
_posts/2023-08-08-resteasy-grpc.md
Outdated
```bash | ||
galleon.sh install wildfly:current --dir=wildfly | ||
galleon.sh install org.jboss.resteasy:galleon-feature-pack:6.2.4.Final --dir=wildfly --ignore-not-excluded-layers=true | ||
galleon.sh install org.wildfly.extras.grpc:wildfly-grpc-feature-pack:0.1.1.Final --layers=grpc --dir=wildfly | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like we should use the wildfly-maven-plugin
to provision the container. It can just be provisioned in the target
directory and used for the test or with the wildfly:dev
goal to do manual testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll learn how to achieve this and if I have questions I'll ask you for help :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jamezp I start to work on using the wildfly-maven-plugin
directly, and here is the draft: liweinan/grpcToRest.example#1
In addition, I need to convert the test to use Arquillian for it to work right?
_posts/2023-08-08-resteasy-grpc.md
Outdated
This means the `key-manager` is not set in the `grpc` subsystem, which means it will use `plaintext` to do the gRPC communication. We can confirm this setting is running the following command: | ||
|
||
```bash | ||
[standalone@localhost:9990 /] /subsystem=grpc:write-attribute(name=key-manager-name, value="") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be /subsystem=grpc:undefine-attribute(name=key-manager-name)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually though, this shouldn't be done at all. If this is an issue we need to fix the subsystem itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay! I'll fix the text firstly for now. @jamezp Could you please provide me more information why this is a problem in the subsystem? Guess I can create an issue for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it says:
This means the
key-manager
is not set in thegrpc
subsystem, which means it will useplaintext
to do the gRPC communication. We can confirm this setting is running the following command:
If there is no change required, I'm not sure why we'd execute the command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To confirm the default setting(in case I modified it locally), I installed a fresh copy of WildFly with Galleon and here are the default settings:
[standalone@localhost:9990 /] ls subsystem=grpc:read-attribute
flow-control-window=undefined max-connection-age-grace=undefined server-port=9555
handshake-timeout=undefined max-connection-idle=undefined session-cache-size=undefined
initial-flow-control-window=undefined max-inbound-message-size=undefined session-timeout=undefined
keep-alive-time=undefined max-inbound-metadata-size=undefined shutdown-timeout=3
keep-alive-timeout=undefined permit-keep-alive-time=undefined ssl-context-name=undefined
key-manager-name=undefined permit-keep-alive-without-calls=undefined start-tls=undefined
max-concurrent-calls-per-connection=undefined protocol-provider=undefined trust-manager-name=undefined
max-connection-age=undefined server-host=localhost
So the key-manager-name
by default is undefined
. I did the test and it passed:
So the attribute actually don't need to be modified. I'll update the both the blog post text and the example source code on this part. Thanks for pointing this out James!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have created a PR here: resteasy/resteasy-examples#158
_posts/2023-08-08-resteasy-grpc.md
Outdated
```bash | ||
➤ curl http://localhost:8080/grpcToRest.example.grpc-1.0.1.Final-SNAPSHOT/grpcToJakartaRest/grpcserver/context | ||
|
||
2Got org.greet.Greet_Server@4c9c8c0a servletContext⏎ | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have we not worked around this yet? I thought we did for some reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add a flag to ensure it just initialized once for now. And in the future maybe we'll change the design as discussed with @ronsigal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ronsigal I've added a flag to check the servletContext
is just initialized once as we discussed: https://github.com/resteasy/resteasy-grpc/pull/18/files @jamezp I'm not sure if we need to change the design of this part totally, if so could you please provide some help on this? :p
@jamezp Thanks for the review! I'll check the details and do the modifications accordingly. :D |
@jamezp Until now all the related changes PRs are merged into the
IMHO the above issues are more or less inter-related and maybe needs sometime to complete, so can this blog post be published for now, and if there are updates/improvements on the whole workflow in the future, then I provide another blog post? |
IMHO it would be nice to get these things fixed so the blog can show a good user experience. I need to walk through it again, which I can probably do today, so I can see how the steps work. I really think we have too many moving parts and we need to make this easier for the end user. |
@jamezp Thanks for help on this! |
I'm not sure why the subsystem should be restarted. Isn't it enough that the new deployment is detected and added to the server? Well, I guess the subsystem should be able to remove the old version of the deployment. |
definitely |
Sorry my description may not be very accurate. The situation is: After the bridge project is redeployed, then the gRPC subsystem stop services at port |
That sounds lie a bug. The server should not be stopping on undeploy. I did rework the subsystem, I wonder if we need a new release. |
+1 |
Ah, I see. Yeah, that's not right. |
@jamezp I have updated the date of the blog post. Please let me know if anything else need to be modified :D |
…gRPC subsystem