This is an example app how one can use Infinispan as a persistency layer for Vaadin app. Wildfly and its provided service is used.
Steps to play around with this app:
Whatever wildfly config you are using, add an Infinispan cache for this demo. E.g. add following lines to standalone-full-ha.xml, under <subsystem xmlns="urn:jboss:domain:infinispan:2.0">
section :
<cache-container name="myCache" default-cache="cachedb">
<local-cache name="cachedb"/>
</cache-container>
To use the replicated mode in a cluster following configuration works fine:
<cache-container name="myCache" default-cache="cachedb">
<transport lock-timeout="60000"/>
<replicated-cache name="cachedb" batching="true" mode="SYNC"/>
</cache-container>
Refer to Infinispan and Wildfly docs for more configuration options. You can for example configure disk storage for "backup" to survive from cluster wide reboots. There are also numerous options how you can fine tune data replication or use "distribution" that will scale better in large clusters.
The perfect setup depends on your setup, but e.g. issue following command from wildfly home
./bin/standalone.sh --server-config=standalone-full-ha.xml
mvn install wildfly:deploy