adjust to java8 api#1060
Conversation
|
Hi @michael-read, Thank you for your contribution! We really value the time you've taken to put this together. Before we proceed with reviewing this pull request, please sign the Lightbend Contributors License Agreement: |
| import cloudflow.streamlets.StreamletShape; | ||
| import cloudflow.streamlets.proto.javadsl.ProtoInlet; | ||
|
|
||
| import scala.None; |
There was a problem hiding this comment.
yes Ray, I missed that to optimize imports. Pushed a new update.
|
@RayRoestenburg test |
| SensorData.class, | ||
| true | ||
| true, | ||
| (inBytes, throwable) -> null |
There was a problem hiding this comment.
@michael-read Did you add this just to skip and not log?
The Java API has a ProtoInlet.create method (I would suggest to use that instead), though it does not have an option to provide the error handler (in case it is important to you not to log but to skip).
There was a problem hiding this comment.
There is now a Java API ProtoInlet.create that takes a errorHandler: (Array[Byte], Throwable) => Optional[T] would be nice if you used that instead of returning null
There was a problem hiding this comment.
yes, I was just skipping it. I'm happy to add a log, if it'll make it better.
There was a problem hiding this comment.
Sorry missed this comment.
Can you return an Optional instead and use the Java API (ProtoInlet.create)?
There was a problem hiding this comment.
@RayRoestenburg so no ProtoOutlet.create?
There was a problem hiding this comment.
Only noticed this now, yes we should add that too to be consistent.
There was a problem hiding this comment.
There is a ProtoInlet.create that takes a (Array[Byte], Throwable) => Optional[T]
There was a problem hiding this comment.
I'm totally lost on this. I don't see the API you're referring to in current. These are the two creates I can see in the API:
static <T extends com.google.protobuf.GeneratedMessageV3>ProtoInlet<T> | create(java.lang.String name, java.lang.Class<T> clazz)
-- | --
static <T extends com.google.protobuf.GeneratedMessageV3>ProtoInlet<T> | create(java.lang.String name, java.lang.Class<T> clazz, boolean hasUniqueGroupId)
So without the .withErrorHandler I'm at a lost. Sorry.
There was a problem hiding this comment.
|
FYI @michael-read I've added a Java API for ProtoInlet for the errorHandler which uses Java Optional: #1066 |
|
On Thu, 15 Jul 2021 at 19:37, michael-read ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In
examples/snippets/modules/ROOT/examples/akkastreams-grpc-java/src/main/java/sensordata/Logger.java
<#1060 (comment)>:
> @@ -14,7 +14,8 @@
private final ProtoInlet<SensorData> inlet = new ProtoInlet<SensorData>(
"in",
SensorData.class,
- true
+ true,
+ (inBytes, throwable) -> null
I'm totally lost on this. I don't see the API you're referring to in
current. These are the two creates I can see in the API:
static <T extends com.google.protobuf.GeneratedMessageV3>ProtoInlet<T> | create(java.lang.String name, java.lang.Class<T> clazz)
-- | --
static <T extends com.google.protobuf.GeneratedMessageV3>ProtoInlet<T> | create(java.lang.String name, java.lang.Class<T> clazz, boolean hasUniqueGroupId)
So without the .withErrorHandler I'm at a lost. Sorry.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1060 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABGGCI56QCKBGQGGMLYYEDTX4MELANCNFSM45XANL5Q>
.
--
*Akka Tech Lead, Lightbend, Inc.*
***@***.*** ***@***.***>
@RayRoestenburg <https://twitter.com/RayRoestenburg>
<https://www.lightbend.com/>
|
|
@michael-read sorry for the late reply, but I think I can see what is going on here, you have not updated your fork, which is why you don't see the code. |
What changes were proposed in this pull request?
The sample needed these changes so that it could compile on Java 8.
Why are the changes needed?
Sample was written using Java API > v8
Does this PR introduce any user-facing change?
No
How was this patch tested?
sbt runLocal, and sent data via
grpcurl -plaintext -d '{"payload":"foo-bar"}' localhost:3000 sensordata.SensorDataService.Provide