@Runwith(ReactorHttpRunner.class)
@RemoteApp("some.other.app.name")
interface DemoClient {
@Get("/api/students/{classId}")
Flux<Student> getStudents(@Path("classId") Integer classId);
@Get("/api/classInfo/{classId}")
Mono<ClassInfo> getClassInfo(@Path("classId") Integer classId);
}
@Controller
public class DemoController {
@Autowired
private DemoClient demoClient;
@GetMapping("/students/{classId}")
public Flux<ClassInfo> students(@PathVariable("classId") Integer classId) {
val students = demoClient.getStudents(classId);
val classInfo = demoClient.getClassInfo(classId).CollectToList();
return classInfo.zip(students)
.map(tuple1 -> {
val cl = tuple1._1();
val st = tuple1._2();
cl.setStudents(st);
return cl;
})
}
}