Commit d05dd788 authored by Lokesh Singh's avatar Lokesh Singh

flux and mono and browser as subscriber

parent f757b68e
package com.lokesh.webfluxdemo.controller;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;
import java.time.Duration;
@RestController
public class FluxAndMonoController {
@GetMapping("/flux")
public Flux<Integer> returnFlux() {
return Flux.just(1,3,4,2)
// .delayElements(Duration.ofSeconds(1))
.log();
}
@GetMapping(value = "/fluxstream", produces = MediaType.APPLICATION_STREAM_JSON_VALUE)
public Flux<Integer> returnFluxStream() {
return Flux.just(1,2,3)
.delayElements(Duration.ofSeconds(1))
.log();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment