Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
from("weather:foo?location=Madrid,Spain&period=7 days&appid=APIKEY").to("jms:queue:weather");

...

Code Block
from("weather:foo?appid=APIKEY").to("jms:queue:weather");

...

Code Block
from("direct:start")
  .to("weather:foo?location=Madrid,Spain&appid=APIKEY");

And we can send in a message with a header to get the weather for any location as shown:

Code Block
  String json = template.requestBodyAndHeader("direct:start", "", "CamelWeatherLocation", "Paris,France&appid=APIKEY", String.class);

And to get the weather at the current location, then:

Code Block
  String json = template.requestBodyAndHeader("direct:start", "", "CamelWeatherLocation", "current&appid=APIKEY", String.class);