-
Notifications
You must be signed in to change notification settings - Fork 38
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
first pass using codegen instead of reflection #73
Conversation
9e9918a
to
da18abb
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.
this is looking very promising
Effect<? extends GeneratedMessageV3> effect = invoke(command, adaptedContext); | ||
// TODO we used to support accepting ScalaPB and Jackson objects as responses as well. | ||
// Are we OK with losing that? I guess we could have separate methods for that on the | ||
// builder, though it's not obvious how to achieve type-safety for those then. |
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, I think we still want the json support. Could perhaps be an additional proto option on the entity (or even rpc) and we would generate different conversion.
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.
Isn't the json support some specific proto type that we could identify here (and turn to some json model) or how did that actually work?
(Somewhat confusing when there is also transcoding from json to proto in the proxy)
samples/java-customer-registry/src/main/java/customer/CustomerValueEntityHandler.java
Outdated
Show resolved
Hide resolved
new CustomerValueEntityHandler( | ||
// TODO I guess construction the Entity should somehow remain part of the | ||
// customer API, so they can pass | ||
// in anything they like in the constructor, including the context? |
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, we should change the registration methods to take a factory lambda CreationContext -> ValueEntity
cd0f01a
to
3f61f0d
Compare
b5cea76
to
5e170c3
Compare
3f61f0d
to
a47d660
Compare
Making the diff to lightbend#73 smaller
77adc6e
to
d21a262
Compare
Making the diff to #73 smaller
6b933b9
to
92ff196
Compare
CustomerDomain.CustomerState parsedState = | ||
CustomerDomain.CustomerState.parseFrom(state.getValue()); | ||
// TODO we used to support passing in the command as Jackson-parsed model object | ||
// or as ScalaPB class as well. With this change we tie ourselves to Java protobuf. |
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 think we can solve the ScalaPB part when we get to doing a Scala SDK?
65efcfb
to
37de787
Compare
@@ -25,7 +25,7 @@ | |||
import java.util.function.Predicate; | |||
import java.util.stream.Collectors; | |||
|
|||
public class ShoppingCartImpl extends AbstractShoppingCart { | |||
public class ShoppingCartImpl extends ShoppingCartInterface2 { |
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.
Ups, my bad!
35ae858
to
0764005
Compare
option (akkaserverless.service) = { | ||
type : SERVICE_TYPE_VIEW | ||
}; |
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.
We don't need this for now. This is only needed when using the codegen and the eventing sample doesn't use it. Anyway, I will remove it for now since I will be pushing to this PR (soon).
Manually create a `CustomerValueEntityHandler` that would be generated as part of codegen. Added basic code to hook it into `Main`, but that API would still change and partly be generated. Reading the codegen code, it's clear we're losing some features that used to be available with codegen, marked them with TODO's - we should consider whether we're OK with losing them or want to introduce new mechanisms.
Regenerate test data against framework 0.7.0-beta.9 and the 'current' sdk. Had to adapt the test to reflect the changes in package in 32d1c07 and add a service type option to the view proto that I couldn't find anywhere in the history.
0764005
to
e236356
Compare
samples/java-customer-registry/src/main/java/customer/CustomerValueEntityHandler.java
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 think we should merge this one for now.
I have done some experiments for the handler, but better to add on a follow up PR.
Manually create a
CustomerValueEntityHandler
that would be generated as part of codegen.Added basic code to hook it into
Main
, but that API would still change and partly be generated.Reading the codegen code, it's clear we're losing some features that used to be available with codegen, marked them with TODO's - we should consider whether we're OK with losing them or want to introduce new mechanisms.