Skip to content
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

[JBTM-3381] Enhance LRA Client for Quarkus #1707

Merged
merged 1 commit into from Oct 31, 2020
Merged

Conversation

ruromero
Copy link
Contributor

@ruromero ruromero commented Oct 29, 2020

Hey,

I wanted to do a small contribution to the client after starting to use it. I hope you find my changes useful and relevant.

  • Clean up unnecessary dependencies and reformat pom.
  • Set PORT and PATH_KEY as constants. I couldn't import them properly in my code
  • Fix the clientID param that was sending an object string representation.
  • joinLRA with a null timelimit was throwing a NPE during the unboxing.
  • Other SonarLint suggestions.
  • The service provided has been replaced by the Microprofile implementation.

I didn't consider meaningful creating a Jira for this but if you feel it's a requirement even for such a small PR I'll do it.
Let me know if I didn't take something into account, specially regarding the pom.xml.

Thank you in advance.

Signed-off-by: ruromero rromerom@redhat.com

Fix https://issues.redhat.com/browse/JBTM-3381

LRA
!MAIN !CORE !QA_JTA !QA_JTS_JDKORB !QA_JTS_OPENJDKORB !QA_JTS_JACORB !BLACKTIE !XTS !PERF NO_WIN !RTS !AS_TESTS !TOMCAT !JACOCO

@jbosstm-bot
Copy link

⚠️ narayana CI not started.

Author is not the 'narayana' contributor, to permit PR being run members of jbosstm can write comment of text: TESTIT

@ochaloup
Copy link
Contributor

TESTIT

@jbosstm-bot
Copy link

@jbosstm-bot
Copy link

@mmusgrov
Copy link
Contributor

@ruromero Thanks, the changes look good except for some procedural tasks:

  • if you haven't already signed our CLA please will you do that;
  • changes must be relevant to the issue being fixed so we don't normally accept code formatting changes;
  • we also prefer that any PR which updates the code has a corresponding JIRA issue (this helps with tracking changes and for generating release notes);

Copy link
Contributor

@ochaloup ochaloup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have few minor points about the code changes. Otherwise it's nice. Thanks.

@@ -320,13 +321,6 @@ public URI startLRA(URI parentLRA, String clientID, Long timeout, ChronoUnit uni
}

lra = URI.create(response.getHeaderString(HttpHeaders.LOCATION));

if (lra == null) {
LRALogger.i18NLogger.error_nullLraOnCreation(response.toString());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please with this remove the method error_nullLraOnCreation from the i18NLogger as well.

@@ -1 +1 @@
org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
org.jboss.resteasy.microprofile.client.impl.MpClientBuilderImpl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change we should be consistent in whole LRA impl. The same change should be done in https://github.com/jbosstm/narayana/blob/master/rts/lra/jaxrs/src/main/resources/META-INF/services/javax.ws.rs.client.ClientBuilder.
I think especially this particular change would be nice to be tracked as a jira.
FYI @xstefank

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you agree on the change I will create the JIRA for this and move it to a specific PR.

@ruromero
Copy link
Contributor Author

@mmusgrov

  • The link you provided to the CLA doesn't seem to work. I have also tried to follow cla.jboss.org but I'm being redirected to a RH site.
  • I will remove code formatting specific changes.
  • Finally, as I was submitting changes so different that I found during the LRA client integration into my project, I didn't know what JIRA to create because first I wanted to know if they made sense at all. Please, tell me what JIRA or JIRAs should I create for each specific change.

Thanks.

@jbosstm-bot
Copy link

@jbosstm-bot
Copy link

@ruromero ruromero changed the title small updates to client [JBTM-3381] Enhance LRA Client for Quarkus Oct 30, 2020
@jbosstm-bot
Copy link

@ruromero
Copy link
Contributor Author

@ochaloup @mmusgrov I have created the Jira and updated the PR.
I have also removed a dependency that was preventing me from running the client in a Quarkus native app.

@jbosstm-bot
Copy link

Copy link
Contributor

@ochaloup ochaloup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me. Thanks.

@mmusgrov
Copy link
Contributor

mmusgrov commented Oct 30, 2020

@mmusgrov

  • The link you provided to the CLA doesn't seem to work. I have also tried to follow cla.jboss.org but I'm being redirected to a RH site.

The revised process for contributions is to include "Signed-off-by:" followed by the contributor’s name and email address in the commit message (which you already did):

Signed-off-by: Your Name <yourname@example.com>

With git, this step can be automated using git commit -s or git commit --signoff.

I will update the automated text generated in new PRs to include this information.

Thanks for bringing this policy change to our attention.

@@ -305,7 +305,7 @@ public URI startLRA(URI parentLRA, String clientID, Long timeout, ChronoUnit uni

response = client.target(base)
.path(START_PATH)
.queryParam(CLIENT_ID_PARAM_NAME, client)
.queryParam(CLIENT_ID_PARAM_NAME, URLEncoder.encode(clientID, "UTF-8"))
Copy link
Contributor

@mmusgrov mmusgrov Oct 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it wise to encode the clientID? A few of points:

  • it is not necessarily a URL since client ids are arbitrary strings and it may be confusing to the client to receive back something other that what he set on the start call;
  • the json data returned by the API call for returning LRAs and the format of the returned data doesn't say anything about us encoding the client id
  • encoded urls are usually for use in html pages but the client id is not for this purpose.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Encoding of the clientID was my idea. I was afraid that the URL escaped characters won't be correctly transfered and interpreted. I was wrong as I can see from testing the functionality.
Agree that encoding is not necessary, sorry for misguidance @ruromero

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, I have reverted the change.

Copy link
Contributor

@mmusgrov mmusgrov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is just my issue about encoding the clientID remaining.

Signed-off-by: ruromero <rromerom@redhat.com>
@ruromero
Copy link
Contributor Author

Done @mmusgrov

@jbosstm-bot
Copy link

@jbosstm-bot
Copy link

@mmusgrov mmusgrov merged commit 55e4b71 into jbosstm:master Oct 31, 2020
@ruromero ruromero deleted the client branch November 3, 2020 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants