Skip to content
Advertisement

Tag: spring-webflux

How to consume infinite flux multiple times

This is what I’m trying to achieve: When somebody requests http://localhost/runIt, I would like to return data from cache that would be refreshed every 6 seconds. Below, I have a flux (always same one that is stored in map) that is first time instantiated and starts emitting numbers 0,1,2,3,4… to infinity. Is it possible to make this Spring MVC Controller

Update 1 or multiple specific field MongoDB using Spring boot WebFlux,Spring Data MongoDB Reactive and ReactiveMongoRepository

I’m newbie with java. I tried to implement update method for my API. I want to update some field of my data. Here is my data class: My service interface: And implement for services: My Controller: And Task Repository: My data in DB: My request body: I expected: But it responsed: It update my missing value in request with null

How throws CustomException from reactive service to controller?

I am receiving a request in a 0.RestController and give it to the service for processing. If service doesnt throw exception, i just return HttpStatus.200, but if an exception occurs in the service, i need catch it in controller and return the status depending on the exception. Inside service, i need to use Mono.fromCallable for repo access. Well, if user

Time Elapsed for Mono Webflux

I am calling a post endpoint that returns a Void. I am trying to get the time elapsed. It seems it is not calling an endpoint. doOnSuccess is also not getting called. Answer elapsed() measures the time between when the Mono is subscribed to and the moment the Mono emits an item. But, Mono<Void> response doesn’t emit any value. You

Building a Recursive Data Structure with Spring WebFlux

I have a REST API that is built with the Spring WebFlux framework, and I have an endpoint which returns a Flux<ChannelResponse>, where ChannelResponse is a tree-structured object, as shown below: Now, I don’t have much experience with the reactive programming paradigm, but this is how I would implement such an endpoint with synchronous logic, such that each top-level channel

Convert Flux into Flux

I am working on spring webflux file upload. From the controller I want to upload the file on amazon S3 bucket. So in the controller I received following object And from the FilePart.content() I can get My question is how can I convert this Flux<DataBuffer> into Flux<ByteBuffer>. I mean into the following object Answer You can simply use the org.springframework.core.io.buffer.DataBuffer#asByteBuffer():

Advertisement