igalshilman commented on a change in pull request #177:
URL: https://github.com/apache/flink-statefun/pull/177#discussion_r529255857
##########
File path:
statefun-flink/statefun-flink-core/src/main/java/org/apache/flink/statefun/flink/core/reqreply/RequestReplyFunction.java
##########
@@ -125,8 +126,44 @@ private void onAsyncResult(
sendToFunction(context, batch);
return;
}
- InvocationResponse invocationResult =
unpackInvocationOrThrow(context.self(), asyncResult);
- handleInvocationResponse(context, invocationResult);
+ if (asyncResult.failure()) {
+ throw new IllegalStateException(
+ "Failure forwarding a message to a remote function " +
context.self(),
+ asyncResult.throwable());
+ }
+
+ final Either<InvocationResponse, IncompleteInvocationContext> response =
+ unpackResponse(asyncResult.value());
+ if (response.isRight()) {
+ handleIncompleteInvocationContextResponse(context, response.right(),
asyncResult.metadata());
+ } else {
+ handleInvocationResultResponse(context, response.left());
+ }
+ }
+
+ private static Either<InvocationResponse, IncompleteInvocationContext>
unpackResponse(
Review comment:
Very good, yes!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]