WillemJiang commented on a change in pull request #594: [SCB-379] support
AsyncRestTemplate
URL:
https://github.com/apache/incubator-servicecomb-java-chassis/pull/594#discussion_r178828367
##########
File path:
samples/springmvc-sample/springmvc-consumer/src/main/java/org/apache/servicecomb/samples/springmvc/consumer/SpringmvcConsumerMain.java
##########
@@ -64,10 +65,25 @@ public static void main(String[] args) throws Exception {
System.out.println("AsyncRestTemplate Consumer sayHi services: " +
responseEntity.getBody());
HttpEntity<Person> entity = new HttpEntity<>(person);
- ListenableFuture<ResponseEntity<String>> exchange = cseAsyncRestTemplate
+ ListenableFuture<ResponseEntity<String>> listenableFuture =
cseAsyncRestTemplate
.exchange("cse://springmvc/springmvchello/sayhello", HttpMethod.POST,
entity, String.class);
- ResponseEntity<String> responseEntity1 = exchange.get();
- System.out.println("AsyncRestTemplate Consumer sayHello services: " +
responseEntity1.getBody());
+// ResponseEntity<String> responseEntity1 = listenableFuture.get();
+// System.out.println("AsyncRestTemplate Consumer sayHello services: " +
responseEntity1.getBody());
+
+ listenableFuture.addCallback(
+ new ListenableFutureCallback<ResponseEntity<String>>() {
+ @Override
+ public void onFailure(Throwable ex) {
+ ex.printStackTrace();
Review comment:
Please printout the exception before printing the stack trace.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services