Skip to content

GH-3183: Add ReactiveRequestHandlerAdvice #3197

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

Merged
merged 2 commits into from
Mar 5, 2020

Conversation

artembilan
Copy link
Member

@artembilan artembilan commented Feb 27, 2020

Fixes #3183

  • Introduce a ReactiveRequestHandlerAdvice with a BiFunction<Message<?>, Mono<?>, Publisher<?>>
    logic to apply a Mono.transform() operator for a returned from the handler Mono reply
  • Fix WebFluxRequestExecutingMessageHandler to return a Mono.then() instead of an explicit subscription -
    it happens downstream anyway during reply producing with a proper error handling, too
  • Demonstrate ReactiveRequestHandlerAdvice in the RSocketDslTests - without retry() it fails
  • Add ConsumerEndpointSpec.customizeMonoReply() for convenience
  • Document ReactiveRequestHandlerAdvice feature

@artembilan artembilan changed the title GH-3183: Add ReactiveRequestHandlerAdvice [DO NOT MERGE YET] GH-3183: Add ReactiveRequestHandlerAdvice Feb 27, 2020
@artembilan
Copy link
Member Author

If the solution is good, I'll go ahead with WebFlux reworking.

This feature opens for us a possible to apply a TransactionInterceptor with a ReactiveTransactionManager onto our reactive-replying components.

I may admit that this could be kinda breaking change though since that modified RSocketOutboundGateway is not an AbstractReplyProducingMessageHandler anymore...

@sirimamilla
Copy link
Contributor

HI @artembilan,

This will add a lot of value. As it gives a lot of scope for customization and unleashes the power of Reactive framework.

@garyrussell
Copy link
Contributor

If the solution is good, I'll go ahead with WebFlux reworking.

LGTM

@artembilan
Copy link
Member Author

I'll come back to this after merging #3201 .
They are kinda depend and complement each other.

@artembilan artembilan changed the title [DO NOT MERGE YET] GH-3183: Add ReactiveRequestHandlerAdvice GH-3183: Add ReactiveRequestHandlerAdvice Mar 3, 2020
@artembilan
Copy link
Member Author

I have changed my mind: now ReactiveRequestHandlerAdvice checks a type of the return from the invocation.proceed().
So, we don't need extra abstraction to enforce reactive behavior for target MessageHandler.

Fixes spring-projects#3183

* Introduce a `ReactiveRequestHandlerAdvice` with a `BiFunction<Message<?>, Mono<?>, Publisher<?>>`
logic to apply a `Mono.transform()` operator for a returned from the handler `Mono` reply
* Fix `WebFluxRequestExecutingMessageHandler` to return a `Mono.then()` instead of an explicit subscription -
it happens downstream anyway during reply producing with a proper error handling, too
* Demonstrate `ReactiveRequestHandlerAdvice` in the `RSocketDslTests` - without `retry()` it fails
* Add `ConsumerEndpointSpec.customizeMonoReply()` for convenience
* Document `ReactiveRequestHandlerAdvice` feature
@garyrussell garyrussell merged commit c84d264 into spring-projects:master Mar 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add hooks for reactive reply customizations: timeout(), retry(), tag() etc.
3 participants