Facebook
From George/Djordje, 3 Years ago, written in Java.
This paste is a reply to Camel Example from George/Djordje - view diff
Embed
Download Paste or View Raw
Hits: 121
  1. JacksonDataFormat dataFormat1 = new JacksonDataFormat(Distance.class);
  2.  
  3. from("direct:getDistance")
  4. .marshal()// What are you serializing here? Could add dataFormat1 inside marshal also
  5. .setHeader("Content-Type").constant("application/json")
  6. .setHeader("Accept").constant("application/json")
  7. .setHeader(Exchange.HTTP_METHOD).constant("GET")
  8. .removeHeader(Exchange.HTTP_PATH)
  9. .toD("https://www.zipcodeapi.com/rest/qqZmn6H64bx2BdF9UWZKivRu5vQVZtejqIQOVXCkPiRwwPVht3feiPEqxIMY3S5P/distance.json/48335/48336/km")
  10. .unmarshal(dataFormat1)
  11. .process(new Processor()
  12. { @Override public void process(Exchange exchange) throws Exception
  13. { System.out.println("in the processor"+ exchange.getIn().getBody());
  14. Distance employeelist = exchange.getIn().getBody(Distance.class) ;
  15. System.out.println("distance value"+ employeelist.getDist­ance());