Infinispan Embedded Tutorial: Weather App

Overview

This is a tutorial which explains how to use Infinispan embedded in your own application. The application will retrieve the current weather conditions for some cities and store them in a cache, for quicker retrieval. It will also show how to configure the cache for expiration, so that entries get removed as they age. It will then demonstrate how to cluster multiple nodes together and reacting to events in the cluster. Finally, a computation of average temperatures per country will show the power of the map/reduce functionality.

Each tagged commit is a separate lesson teaching a single aspect of Infinispan.

The tutorial instructions are at http://infinispan.org/tutorials/embedded/

N.B. The tutorial connects to OpenWeatherMap (http://openweathermap.org) to retrieve current weather data. The service requires obtaining a free API key. Before launching the application, ensure you've set the OWMAPIKEY environment variable to your API key. If you don't want to register for the service, if you don't have an Internet connection or you are having trouble connecting to the service, just don't set the environment variable, and it will use the RandomWeatherService.

Prerequisites

Git

JDK

Maven

Commits / Tutorial Outline

You can check out any point of the tutorial using git checkout step-?

To see the changes between any two lessons use the git diff command. git diff step-?..step-?

step-0/setup

step-1/cache-manager

step-2/cache-put-get

step-3/expiration

step-4/cachemanager-configuration

step-5/clustering

step-6/cachemanager-listener

step-7/cache-listener

step-8/grouping

step-9/externalizer

step-10/streams

step-11/declarative-configuration

Building and running the tutorial

Application Directory Layout

docker/             -->
src/                -->
  main/             -->
    java/           -->
    resources/      -->

Contact

For more information on Infinispan please check out http://infinispan.org/