java-tutorials/kdoyle/RealTimeTest.java

22 lines
604 B
Java
Raw Normal View History

2018-05-02 00:18:41 -04:00
package com.baeldung.reactive.kdoyle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.client.WebClient;
@Component
public class RealTimeTest {
@Autowired
WebClient client;
public void read(){
client.get().uri("/read")
.accept(MediaType.TEXT_EVENT_STREAM)
.retrieve()
.bodyToFlux(ReadingBook.class)
.subscribe(System.out::println);
}
}