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.
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-?
mvn clean package
to rebuild the applicationmvn exec:exec
to execute the application. In case you're running a clustered step, run this from
multiple terminals, where each instance will represent a nodemvn clean package docker:build
to build docker image, and then run docker run infinispan-embedded-tutorial/infinispan-embedded-tutorial
in 2 different terminals to simulate multiple nodes of distributed cachedocker/ -->
src/ -->
main/ -->
java/ -->
resources/ -->
For more information on Infinispan please check out http://infinispan.org/