Commit 886e8bcb authored by Bhanuchander Pathuri's avatar Bhanuchander Pathuri

flux to mono converstion using next() method

parent 5635c3db
......@@ -22,8 +22,10 @@ public class WebclientEx {
public void getAllStudents(){
log.info("----------------------------------in scheduler method--------------------------------");
WebClient client = WebClient.create("http://localhost:4042");
Flux<Address> studentFlux = client.get().uri("/alladdress").accept(MediaType.TEXT_EVENT_STREAM).retrieve().bodyToFlux(Address.class);
studentFlux.filter(a -> a.getCity().equalsIgnoreCase("hyd")).subscribe(a -> System.out.println(a.toString()));
Flux<Address> addressFlux = client.get().uri("/alladdress").accept(MediaType.TEXT_EVENT_STREAM).retrieve().bodyToFlux(Address.class);
//converting Flux to Mono using next()
Mono<Address> addressMono = client.get().uri("/alladdress").accept(MediaType.TEXT_EVENT_STREAM).retrieve().bodyToFlux(Address.class).next();
addressFlux.filter(a -> a.getCity().equalsIgnoreCase("hyd")).subscribe(a -> System.out.println(a.toString()));
//return studentFlux;
}
......
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