spring-webflux

transform vs transformDeferred

主宰稳场 提交于 2021-02-08 10:10:41
问题 What is the difference between transform & transformDeferred in project reactor flux. Good example will be helpful. https://projectreactor.io/docs/core/release/reference/index.html#advanced-mutualizing-operator-usage 回答1: Most of the time, a Flux is "lazy": you declare a processing pipeline, but data only starts flowing once you subscribe to it. You can subscribe multiple times. This is called a cold Flux (and each time you subscribe to a cold source, the source generates its data anew for

Spring reactive ReactorNettyWebSocketClient not logging anything

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-08 09:36:13
问题 I've created a simple demo application to familiarize myself with the new WebSocketClient. I found a tutorial at: https://stackify.com/reactive-spring-5/ (Reactive WebSocket Clients): @Bean CommandLineRunner demo() { return args -> { Flux<String> input = Flux.<String>generate(sink -> sink.next("This is a test")) .delayElements(Duration.ofSeconds(1)); WebSocketClient client = new ReactorNettyWebSocketClient(); client.execute(new URI("ws://echo.websocket.org"), session -> session.send(input.map

Reactive way to read and parse file from resources using WebFlux?

試著忘記壹切 提交于 2021-02-08 06:59:27
问题 I wonder what is the correct way to read, parse and serve a file from resources. Currently, I do something like this: fun getFile(request: ServerRequest): Mono<ServerResponse> { val parsedJson = objectMapper.readValue(readFile("fileName.json"), JsonModel::class.java) // modify parsed json return ok().contentType(APPLICATION_JSON).bodyValue(parsedJson) } private fun readFile(fileName: String) = DefaultResourceLoader() .getResource(fileName) .inputStream.bufferedReader().use { it.readText() } I

Spring WebFlux with traditional Web Security

≡放荡痞女 提交于 2021-02-08 06:54:21
问题 I tried to test Spring WebFlux with traditional Web Security( @EnableWebSecurity ). I used the Tomcat intead of Netty. I got the follow error message. *************************** APPLICATION FAILED TO START Description: The bean 'springSecurityFilterChain', defined in class path resource [org/springframework/boot/actuate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfiguration.class], could not be registered. A bean with that name has already been defined in class path

Is Spring webclient non-blocking client?

只谈情不闲聊 提交于 2021-02-07 22:37:08
问题 I don't understand reactive webclient works. It says that spring webclient is non-blocking client, but this webclient seems waiting signal onComplete() from remote api, then it can process each item that emitted from the remote api. I'm expecting that webclient can process each item when onNext() is fired from the target api I'm new in the spring webflux worlds. I read about it and it says it uses netty as default server. And this netty using eventloop. So to understand how it works I try to

Spring boot 2 reactive web websocket conflict with datarest

让人想犯罪 __ 提交于 2021-02-07 20:26:20
问题 I'm using spring boot 2 to create a project and use websocket using reactive web dependency. My application is worked correctly until I add datarest dependency. after I add datarest dependency application give ' failed: Error during WebSocket handshake: Unexpected response code: 404 is any way to resolve this conflict?. pom.xml <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-integration</artifactId> </dependency> <dependency> <groupId

Running Spring Webflux Application as a WAR

早过忘川 提交于 2021-02-07 15:14:35
问题 I have a Spring reactive sample application that was modified from one of the examples that was provided in the the Spring Webflux documentation. The master branch of this application uses Spring Boot in the traditional manner, with an embedded application server (Netty). It is working fine. In the Liberty branch, I am trying to build the application as a WAR and deploy to Websphere Liberty Profile. Aside from changes to the build process, the most significant code change is having my

Running Spring Webflux Application as a WAR

懵懂的女人 提交于 2021-02-07 15:13:04
问题 I have a Spring reactive sample application that was modified from one of the examples that was provided in the the Spring Webflux documentation. The master branch of this application uses Spring Boot in the traditional manner, with an embedded application server (Netty). It is working fine. In the Liberty branch, I am trying to build the application as a WAR and deploy to Websphere Liberty Profile. Aside from changes to the build process, the most significant code change is having my

Spring Cloud Contract for Webflux Reactive APIs

旧城冷巷雨未停 提交于 2021-02-07 14:28:34
问题 I'm trying to apply Spring Cloud Contract to a Reactive API built with Spring Webflux. Basically be able to send a Flux and receive a response Flux from an API in the style of: @RequestMapping("/endlessecho") public Flux<String> endlessEcho(Flux<String> input) { return input; } I can however find no information online or in the documentation on whether I can do this with Spring Cloud Contract. Is it even possible to write a Contract for this? Will it be able to feed wiremock and generate the

Spring Cloud Contract for Webflux Reactive APIs

假如想象 提交于 2021-02-07 14:28:30
问题 I'm trying to apply Spring Cloud Contract to a Reactive API built with Spring Webflux. Basically be able to send a Flux and receive a response Flux from an API in the style of: @RequestMapping("/endlessecho") public Flux<String> endlessEcho(Flux<String> input) { return input; } I can however find no information online or in the documentation on whether I can do this with Spring Cloud Contract. Is it even possible to write a Contract for this? Will it be able to feed wiremock and generate the