-
Notifications
You must be signed in to change notification settings - Fork 39
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
feat: typed component client #1685
Conversation
sdk/java-sdk-spring/src/main/java/kalix/spring/ActionCallBuilder.java
Outdated
Show resolved
Hide resolved
Back to draft again, one more issue with encoding :/ |
sdk/java-sdk-spring/src/main/scala/kalix/spring/impl/RestKalixClientImpl.scala
Outdated
Show resolved
Hide resolved
ready for review again |
* limitations under the License. | ||
*/ | ||
|
||
package kalix.javasdk.impl.client |
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'm not sure about packaging here and for MethodRefResolver
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.
MethodRefResolver
should stay in impl as it is not directly exposed to end users, if I'm not mistaken.
On the other hand, ComponentCall
to ComponentCall22
must be public and we need to offer guarantees. Also good if we make them final
.
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.
ComponentCall still need to move to public package. It's user land api.
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.
final added
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.
that's a bit problematic, because it's a scala code, or you mean to just change the package 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.
do you think I should rewrite it in Java?
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.
ok, moved to a proper package
sdk/java-sdk-spring/src/test/java/kalix/spring/ComponentClientTest.java
Outdated
Show resolved
Hide resolved
@@ -16,12 +16,15 @@ | |||
|
|||
package kalix.spring.impl |
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.
Ok ready for review, I simplified the old code a bit and add separate methods for the typed client.
…-kalixclient # Conflicts: # sdk/java-sdk-spring/src/it/java/com/example/wiring/workflowentities/TransferWorkflow.java # sdk/java-sdk-spring/src/it/java/com/example/wiring/workflowentities/TransferWorkflowWithFraudDetection.java # sdk/java-sdk-spring/src/it/java/com/example/wiring/workflowentities/TransferWorkflowWithoutInputs.java # sdk/java-sdk-spring/src/it/java/com/example/wiring/workflowentities/WorkflowWithDefaultRecoverStrategy.java # sdk/java-sdk-spring/src/it/java/com/example/wiring/workflowentities/WorkflowWithRecoverStrategy.java # sdk/java-sdk-spring/src/it/java/com/example/wiring/workflowentities/WorkflowWithTimeout.java # sdk/java-sdk-spring/src/main/scala/kalix/javasdk/impl/EntityDescriptorFactory.scala
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.
Looking good. I left a few comments.
I will do a second pass after lunch.
return new ActionCallBuilder(kalixClient); | ||
} | ||
|
||
public ValueEntityCallBuilder forValueEntity() { |
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.
Is that variant intended for methods annotated with @GenerateId
?
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
* limitations under the License. | ||
*/ | ||
|
||
package kalix.javasdk.impl.client |
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.
ComponentCall still need to move to public package. It's user land api.
sdk/java-sdk-spring/src/main/scala/kalix/javasdk/impl/reflection/EntityKeyExtractor.scala
Outdated
Show resolved
Hide resolved
val entityKeysOnType = idValue(component) | ||
val entityKeyOnMethod = idValue(method) | ||
|
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.
for our own sanity, we should call it entityIds..
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.
yeah, copy paste from the source before the renaming
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 class should be IdExtractor.scala
. We can remove the entity
prefix in all places.
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.
removed
sdk/java-sdk-spring/src/main/scala/kalix/spring/impl/KalixSpringApplication.scala
Outdated
Show resolved
Hide resolved
sdk/java-sdk-spring/src/main/scala/kalix/spring/impl/KalixSpringApplication.scala
Outdated
Show resolved
Hide resolved
sdk/java-sdk-spring/src/test/java/kalix/spring/ComponentClientTest.java
Outdated
Show resolved
Hide resolved
sdk/java-sdk-spring/src/main/scala/kalix/javasdk/impl/http/HttpEndpointMethodDefinition.scala
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.
I realise now that they are all under kalix.spring
. It should be under kalix.javasdk
instead.
sdk/java-sdk-spring/src/main/scala/kalix/spring/impl/RestKalixClientImpl.scala
Outdated
Show resolved
Hide resolved
sdk/java-sdk-spring/src/main/java/kalix/spring/ComponentClient.java
Outdated
Show resolved
Hide resolved
sdk/java-sdk-spring/src/main/java/kalix/spring/EventSourcedEntityCallBuilder.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, with some minor suggestions and change requests. Good for merge after that.
sdk/java-sdk-spring/src/main/java/kalix/javasdk/client/ComponentClient.java
Outdated
Show resolved
Hide resolved
* <pre>{@code | ||
* public Effect<String> createUser(String userId, String email, String name) { | ||
* //validation here | ||
* var defCall = componentClient.forValueEntity(userId).call(UserEntity::createUser).params(email, 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.
Nice to have this example code. 💯
We are using pure java, but that's not a common style. Good to have a clear example.
sdk/java-sdk-spring/src/main/java/kalix/javasdk/client/ComponentClient.java
Outdated
Show resolved
Hide resolved
sdk/java-sdk-spring/src/main/java/kalix/javasdk/client/ComponentClient.java
Outdated
Show resolved
Hide resolved
sdk/java-sdk-spring/src/main/java/kalix/javasdk/client/ComponentClient.java
Outdated
Show resolved
Hide resolved
sdk/java-sdk-spring/src/main/scala/kalix/javasdk/client/ComponentCall.scala
Show resolved
Hide resolved
…ntClient.java Co-authored-by: Renato Cavalcanti <[email protected]>
…ntClient.java Co-authored-by: Renato Cavalcanti <[email protected]>
…ntClient.java Co-authored-by: Renato Cavalcanti <[email protected]>
…ntClient.java Co-authored-by: Renato Cavalcanti <[email protected]>
References #1335
Ready for review, in the following PRs I'm planning to: