-
Notifications
You must be signed in to change notification settings - Fork 69
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
APP-3032: Revamping of the API Invoker #234
Conversation
symphony-bdk-core-invokers -> symphony-bdk-http symphony-bdk-core-invoker-api -> symphony-bdk-http-api symphony-bdk-core-invoker-jersey2 -> symphony-bdk-http-jersey2 HttpClient to fluently call ApiClient when used outside generated code. Unittest added. **Documentation not ready yet.**
c152927
to
c902005
Compare
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.
If I understand correctly the goal of the http modules is to be able to choose the http client implementation you want to use, do we have reasons to offer that possibility vs just choosing one and sticking to it?
symphony-bdk-core/src/main/java/com/symphony/bdk/core/HttpClient.java
Outdated
Show resolved
Hide resolved
import javax.ws.rs.core.GenericType; | ||
|
||
@Slf4j | ||
public class HttpClient { |
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.
Our http client looks very similar to the jersey one, will this api work with other clients? (we could try openfeign and the jdk ones for instance)
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.
And Spring WebClient (priority for SpringBoot integration)
symphony-bdk-core/src/main/java/com/symphony/bdk/core/HttpClient.java
Outdated
Show resolved
Hide resolved
import javax.ws.rs.core.GenericType; | ||
|
||
@Slf4j | ||
public class HttpClient { |
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.
And Spring WebClient (priority for SpringBoot integration)
symphony-bdk-core/src/main/java/com/symphony/bdk/core/HttpClient.java
Outdated
Show resolved
Hide resolved
symphony-bdk-core/src/main/java/com/symphony/bdk/core/util/ProviderLoader.java
Outdated
Show resolved
Hide resolved
symphony-bdk-core/src/main/java/com/symphony/bdk/core/util/ProviderLoader.java
Outdated
Show resolved
Hide resolved
symphony-bdk-core/src/main/java/com/symphony/bdk/core/HttpClient.java
Outdated
Show resolved
Hide resolved
Move the HttpClient class to symphony-bdk-http module Create GenericClass to break the dependency of the generic http client on the jersey Generic type Update api.mustache to use GenericClass Update ProviderLoader to make it generic
Javadoc updated
symphony-bdk-core/src/main/java/com/symphony/bdk/core/util/ProviderLoader.java
Outdated
Show resolved
Hide resolved
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.
you should be able to remove the dependency on jersey in the http api module
added a few small comments, otherwise it looks good to me, we can merge that one and then move one with the webclient in a separate PR if you prefer
symphony-bdk-core/src/main/java/com/symphony/bdk/core/util/ServiceLookup.java
Outdated
Show resolved
Hide resolved
final AuthenticateRequest req = new AuthenticateRequest(); | ||
req.setToken(jwt); | ||
|
||
Token token = bdk.http() |
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.
if the http client is meant to be used for other usecases (outside of the SDK), perhaps we don't need to make it accessible in the BDK object (you would just create the Http client using the builder on its own)
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 idea is suggested by @symphony-thibault to make the bdk usage more fluent. @symphony-thibault WDYT ?
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 way developers don't need to pass the ApiClientBuilderProvider
, it uses the one defined in SymphonyBdk
found from ServiceLoader
* HttpClient is the main entry point to fluent API used to build an {@link ApiClient} and execute | ||
* client requests in order to consume responses returned | ||
*/ | ||
public class HttpClient { |
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.
if we want to enforce the use of the builder we can add a private constructor here
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 only added the constructor for unittest purpose. Jacoco complained that the code coverage on HttpClient didn't reach 90% even when intellij said 100%, I think it's because the default constructor is not tested (not really sure about it)
...xamples/bdk-core-examples/src/main/java/com/symphony/bdk/examples/HttpClientExampleMain.java
Outdated
Show resolved
Hide resolved
...dk-http/symphony-bdk-http-api/src/main/java/com/symphony/bdk/http/api/util/GenericClass.java
Outdated
Show resolved
Hide resolved
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.
LGTM 👍
Ticket
3032
Description
BDK: Revamping of the API Invoker
Dependencies
List the other pull requests that should be merged before/along this one.
Checklist