Author: Martin Gencur
Level: Intermediate
Technologies: Infinispan, HotRod, REST
Summary: The rapid-stock-market
quickstart demonstrates how to enable Infinispan compatibility mode so that data can be read/written over different protocols.
Target Product: JDG
Product Versions: JDG 7.x
Source: https://github.com/infinispan/jdg-quickstart
The rapid-stock-market
quickstart demonstrates the behaviour of a compatibility mode. Updates of shares are
being stored in a cache via HotRod client and retrieved via REST client.
The quickstart consists of two applications: a server-side application and client-side application.
All you need to build this project is Java 8.0 (Java SDK 1.8) or better, Maven 3.0 or better.
The application this project produces is designed to be run on Red Hat JBoss Data Grid 7.x
If you have not yet done so, you must Configure Maven before testing the quickstarts.
-
Build a server module for Red Hat JBoss Data Grid (JDG) Server. In this step, a class common to both clients and the server is packaged in a single jar file and placed in a directory structure similar to a server module.
mvn clean package -Pprepare-server-module
-
Install the server module into the server.
-
Copy the prepared module into the server:
cp -r target/modules ${JDG_HOME}/
-
Add the new module as a dependency of the
org.infinispan.commons
module. I.e. add<module name="org.infinispan.quickstart.compatibility.common"/>
tomodule.xml
inmodules/system/layers/base/org/infinispan/commons/main
-
-
Configure JDG server to use a proper configuration file.
-
Copy an example configuration file for a compatibility mode to a correct location where JDG server can pick it up.
cp ${JDG_HOME}/docs/examples/configs/standalone-compatibility-mode.xml ${JDG_HOME}/standalone/configuration
-
Disable REST security by removing
security-domain
andauth-method
attribute definitions from<rest-connector>
configuration element.
-
-
Start JDG server
${JDG_HOME}/bin/standalone.sh -c standalone-compatibility-mode.xml
-
Build the application.
mvn clean package
-
Open another terminal and start the server-side application - Market Updater
mvn exec:java
-
Open yet another terminal and start the client-side application
mvn exec:java -Pclient
-
Follow the help for the client application and try it out!