Hi Markus (and others)
@Markus - your example got me going and I now have a working example.
(It's very easy to get this running on your PC - see the README)
I made some changes to your original suggestion, my thorntail use autodetection of the fractions, so as soon as I use Infinispan code, the infinispan fraction is included, so I made it provided in the pom.xml.
I go it working to cache on one thorntail server, and read the cache on the other server (distributed grid). The cache also expire after a minute, and is configured with infinispan.xml.
However, I could not get the notifications / events to work :(
For JCache (ideally what I would want to use) :
@Log @RequestScoped
public class CacheListener {
public void cacheEntryCreatedEvent(@Observes CacheEntryCreatedEvent event) {
System.out.println(">>>>>>> JCACHE >> New entry " + event.getKey() + " created in the cache");
}
public void cacheEntryEvent(@Observes CacheEntryEvent event) {
System.out.println(">>>>>>> JCACHE >> entry event " + event.getKey() + " [" + event + "]");
}
public void cacheEntryExpiredEvent(@Observes CacheEntryExpiredEvent event) {
System.out.println(">>>>>>> JCACHE >> Old entry " + event.getKey() + " expiring");
}
public void cacheStartedEvent(@Observes CacheStartedEvent event) {
System.out.println(">>>>>>> JCACHE >> New cache " + event.getCacheName() + " started");
}
}
For Infinispan:
@Listener (clustered = true)
public class PrintWhenAdded {
@CacheEntryCreated
public void print(CacheEntryCreatedEvent event) {
System.out.println(">>>>>>> INFINISPAN >> New entry " + event.getKey() + " created in the cache");
}
}
Any suggestions ? Should I rather as on the Infinispan group ?
Thanks in advance