Skip to content
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

Support non-blocking, Reactive Streams compliant execution modes #19

Open
kdavisk6 opened this issue May 16, 2019 · 0 comments
Open

Support non-blocking, Reactive Streams compliant execution modes #19

kdavisk6 opened this issue May 16, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@kdavisk6
Copy link
Member

As with #18, Feign supports non-blocking, reactive execution modes through wrappers andthrough Hystrix's Observable support. Given Feign's originated before non-blocking techniques such as reactive stream existed, attempting to add support to Feign has proven difficult. Non-blocking execution requires a mindset change due to it's use of an event loop and assumption that all events operate asynchronously.

We should take this opportunity to discuss how we can add non-blocking support, through the use of Reactive Streams or native java.util.concurrent.Flow available in JDK 9+.

Types to consider are:

  • java.util.concurrent.Flow.Publisher
  • org.reactivestreams.Publisher

Methods that specify these return types should be executed on an executor pool, either of the user's choosing or a reasonable default one, with their results returned directly, ideally after decoding the response. Care must be taken to ensure that any step in the request process that may block be wrapped and executed asynchronously to avoid blocking the event loop. The following list of components are capable of blocking:

  • RequestEncoder
  • RequestInterceptor
  • Client
  • ResponseDecoder
  • ExceptionHandler

I suspect that the TargetMethodHandler implementation for these types will need to determine how to handle these cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant