Skip to content

Commit

Permalink
GH-118: Fix auto-wire ambiguity in the HttpSupplierConfiguration
Browse files Browse the repository at this point in the history
Fixes: #118

* Use `toReactivePublisher(true)` instead of manual lifecycle control for the `WebFluxInboundEndpoint`
  • Loading branch information
artembilan committed Dec 19, 2024
1 parent 9bc93a9 commit 9b1754b
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,18 @@ public Publisher<Message<byte[]>> httpSupplierFlow(HttpSupplierProperties httpSu
.codecConfigurer(serverCodecConfigurer)
.crossOrigin((crossOrigin) -> crossOrigin.origin(httpSupplierProperties.getCors().getAllowedOrigins())
.allowedHeaders(httpSupplierProperties.getCors().getAllowedHeaders())
.allowCredentials(httpSupplierProperties.getCors().getAllowCredentials()))
.autoStartup(false))
.allowCredentials(httpSupplierProperties.getCors().getAllowCredentials())))
.enrichHeaders((headers) -> headers.headerFunction(MessageHeaders.CONTENT_TYPE,
(message) -> (MediaType.APPLICATION_FORM_URLENCODED
.equals(message.getHeaders().get(MessageHeaders.CONTENT_TYPE, MediaType.class)))
? MediaType.APPLICATION_JSON : null,
true))
.toReactivePublisher();
.toReactivePublisher(true);
}

@Bean
public Supplier<Flux<Message<byte[]>>> httpSupplier(Publisher<Message<byte[]>> httpRequestPublisher,
WebFluxInboundEndpoint webFluxInboundEndpoint) {

return () -> Flux.from(httpRequestPublisher)
.doOnSubscribe((subscription) -> webFluxInboundEndpoint.start())
.doOnTerminate(webFluxInboundEndpoint::stop);
public Supplier<Flux<Message<byte[]>>> httpSupplier(Publisher<Message<byte[]>> httpSupplierFlow) {
return () -> Flux.from(httpSupplierFlow);
}

}

0 comments on commit 9b1754b

Please sign in to comment.