I am calling a Rest Service with a WebClient but I only get a response back which is the following:
Object is reactor.core.publisher.LambdaSubscriber@4681c175
I was hoping to get a JSON string back. When I call the service with a RestTemplate I get the expected JSON string back. Here is the code I use to make the call that returns the Lambda object back:
Object objj= WebClient.create("http://localhost/printer-service/jobs")
.get()
.accept(MediaType.APPLICATION_STREAM_JSON)
.exchange()
.flatMapMany(cr -> cr.bodyToFlux(String.class))
.subscribe(System.out::println);
System.out.println("Object is "+objj);
Why is this call not returning the JSON string?
Aucun commentaire:
Enregistrer un commentaire