My requirements were:
- Asynchronous integration through messaging to avoid any performance impact.
- Reduce service calls to OpenWeatherMap.org API, since weather does not change any 10 mintes and is not different any 100 meters.
There result is the architecture above. The clients are sending geo coordinates to a topic and can fetch the current weather information and weather forecast from a different topic, filtered by their client ID.
Works pretty well, the amount of requests to the OpenWeatherMap API is reduced by approximately 80% by using ehcache. I store weather information as JSON String in-memory in Ehcache which guarantees very fast data access times.