-
Notifications
You must be signed in to change notification settings - Fork 317
Controller method cannot return CompletableFuture if any method argument is Mono
#604
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
Controller method cannot return CompletableFuture if any method argument is Mono
#604
Conversation
CompletableFuture
's from datafetchersCompletableFuture
's from datafetchers
Object result = validateAndInvoke(args, environment); | ||
|
||
if (result instanceof CompletableFuture<?>) { | ||
return Mono.fromFuture((CompletableFuture<?>) result); | ||
} | ||
|
||
return result; |
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.
Not sure if more types should be checked here? Or whether this "shortcut" of not processing the return value should be removed completely, because even when there aren't any Mono
types in the arguments, the return type still could be a Publisher
or CompletableFuture
.
Generally, we mean to let Can you provide more details on the original problem, what do you observe and what happens exactly? Is it an error log message, or an error in the response, what component creates that "Unknown value" error message, etc |
I can't verify it myself right now, but I believe that if you run the test without the implementation changes you should be able to observe the problem yourself. |
But the issue we were experiencing was along the lines of that a resolver function with a signature like For all those cases we added |
I did look into it again, and I now remember what was going wrong; the returned This mono is then unwrapped somewhere, but then it's still a |
b4329a4
to
6d125bd
Compare
When returning `CompletableFuture`s from datafetchers we sometimes encounter an error in the lines of `Unknown value 'java.util.concurrent.CompletableFuture@e77cd7a[Completed normally]'`. By converting the future to a mono it should be handled properly.
6d125bd
to
9b62386
Compare
CompletableFuture
's from datafetchersMono
When returning
CompletableFuture
s from datafetchers we sometimes encounter an error in the lines ofUnknown value 'java.util.concurrent.CompletableFuture@e77cd7a[Completed normally]'
.By converting the future to a mono it should be handled properly.
This is probably not a complete solution, and maybe the returned
CompletableFuture
should be handled somewhere different, but this at least seems to solve the issue.