RanjeetKaur17 b7d4a00dac A simple Real Time streaming example with Spring Webflux.
1. Added an API to generate a real time stream returning numbers.
2. Added Test case to consume that API with a webTestClient.
3. Added a client to consume that API, over the network.
2018-07-03 22:55:47 +04:00

29 lines
735 B
Java

package com.springwebflux.sample;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.web.reactive.function.client.WebClient;
/**
* @author ranjeetkaur
*
*/
@SpringBootApplication(scanBasePackages = "com.springwebflux.*")
@EnableAsync
public class Client {
public static void main(String[] args) throws InterruptedException {
WebClient webClient = WebClient.builder()
.baseUrl("http://localhost:8090")
.build();
webClient.get()
.uri("/v1/dice")
.retrieve()
.bodyToFlux(Integer.class)
.log();
Thread.sleep(10000);
}
}