Fix generics for customizeMonoReply()
Related to: https://stackoverflow.com/questions/68637283/how-to-customize-response-in-spring-integration-using-webflux-when-a-specific-er The function provided for the `ConsumerEndpointSpec.customizeMonoReply()` may convert incoming value to something else. With wildcards it cannot be compiled without casting. * Add `<T, V>` generic arg for the `customizeMonoReply()` to conform in and out types carrying. * Modify `WebFluxDslTests` to demonstrate the problem and confirm the fix **Cherry-pick to `5.4.x` & `5.3.x`**
This commit is contained in:
committed by
Gary Russell
parent
b949b90d66
commit
024ffd1423
@@ -91,6 +91,7 @@ import org.springframework.web.context.WebApplicationContext;
|
||||
import org.springframework.web.reactive.config.EnableWebFlux;
|
||||
import org.springframework.web.reactive.config.WebFluxConfigurer;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
import org.springframework.web.reactive.function.client.WebClientResponseException;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
@@ -422,8 +423,12 @@ public class WebFluxDslTests {
|
||||
.id("webFluxWithReplyPayloadToFlux")
|
||||
.customizeMonoReply(
|
||||
(message, mono) ->
|
||||
mono.timeout(Duration.ofMillis(100))
|
||||
.retry()));
|
||||
mono.
|
||||
timeout(Duration.ofMillis(100))
|
||||
.retry()
|
||||
.onErrorResume(
|
||||
WebClientResponseException.NotFound.class,
|
||||
ex -> Mono.just("Not Found"))));
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
Reference in New Issue
Block a user