This is a tutorial which explains how to access and use Infinispan Servers using Remote APIs offered from within your own application.
Each tagged commit is a separate lesson teaching a single aspect of Infinispan.
- Get a JDK. You will need version 1.7 or higher
- Get Maven. You will need version 3.2 or higher
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-?
- Setup a basic Maven project with dependencies
- Create a simple class which connects to an Infinispan Server
- To run tutorial section:
- Download Infinispan Server and unzip locally
- Start server running
bin/standalone.sh
orbin/standalone.bat
- Run
mvn compile exec:java
to execute the application
- Automate downloading and unzipping of Infinispan Server via Maven
- Automate starting and stopping Infinispan Server using Arquillian
- Create a test where the Infinispan Server details are injected
- Connect to the Infinispan Server and obtain the default cache
- Store an entry into the remote cache
- Retrieve an entry from the remote cache
- Print the entry and assert that it contains the expected value
- Execute
mvn verify -Dit.test=RemoteIT
to verify remote cache reads and writes as expected - You can run this section and all other integration tests by calling
mvn verify
- Storing entries which expire
- Execute
mvn verify -Dit.test=RemoteIT
to verify expiration works (mvn verify
to run all integration tests)
- Demonstrates how to keep a counter consistent with concurrent modifications using the remote concurrent APIs
- Execute
mvn verify -Dit.test=RemoteConcurrencyIT
to verify that the concurrent APIs work as expected (mvn verify
to run all integration tests)
- Receive events in the client when entries in the cache change
- Execute
mvn verify -Dit.test=RemoteListenerIT
to see remote events in action (mvn verify
to run all integration tests)
- Receive events in the client only for filtered keys
- Core dependency added to implement cache event filter SPI
- Execute
mvn verify -Dit.test=RemoteListenerFilterIT
to see filtered remote events in action (mvn verify
to run all integration tests)
- Receive custom events in the client which include value as well as key
- Execute
mvn verify -Dit.test=RemoteListenerCustomIT
to see custom remote events in action (mvn verify
to run all integration tests)
- Shows how to interact with the Infinispan REST Http API to store, retrieve and delete data
- Demonstrates REST Http conditional store operations using
ETag
information - Includes examples on how to store ephemeral entries via REST Http API
- Execute
mvn verify -Dit.test=RemoteRestHttpIT
to see custom remote events in action (mvn verify
to run all integration tests)
- Demonstrates Infinispan's compatibility mode where data can be stored and retrieved using different remote endpoints.
- In this tutorial, interaction between REST and RemoteCache (Hot Rod protocol) endpoints is shown via a simple application that stores simplified stock market.
- Data stored via RemoteCache can be retrieved via REST and vice-versa.
- In order for compatibility to work, stored data needs to be transformed from one endpoints' format to the other's. This is why this tutorial adds an Arquillian extension in order to install/uninstall a module containing the classes representing the stored data.
- Execute
mvn verify -Dit.test=RemoteCompatibilityIT
to see remote compatibility mode in action (mvn verify
to run all integration tests)
src/ -->
main/ -->
java/ -->
resources/ -->
test/ --> test code root directory
java/ --> java test classes root directory
resources/ --> test resources, e.g. arquillian configuration file
For more information on Infinispan please check out http://infinispan.org/