I have Wildfly configured to use caches for hibernate, as shown below:
<subsystem xmlns="urn:jboss:domain:infinispan:3.0">
<cache-container name="hibernate" default-cache="local-query" module="org.hibernate.infinispan">
<local-cache name="local-query">
<transaction mode="NON_XA"/>
<eviction strategy="LRU" size="10000"/>
<expiration max-idle="28800000"/>
</local-cache>
<local-cache name="entity">
<transaction mode="NON_XA"/>
<eviction strategy="LRU" size="10000"/>
<expiration max-idle="28800000"/>
</local-cache>
<local-cache name="timestamps">
<transaction mode="NON_XA"/>
<eviction strategy="NONE"/>
</local-cache>
</cache-container>
</subsystem>
I would like to expose a hotrod endpoint and listen to cache events in a very similar way to how I can do this with Infinispan Server. I am doing this because I am replicating the underlying database manually and selectively, and I would like to manually invalidate the Hibernate cache on the other end as well.
How can I do this?
You can embed the hotrod server in a WildFly deployment. You need to grab the WildFly cache manager from JNDI and then launch the HotRodServer with it. I have a little project [1] which demonstrates how to set up something like this.
[1] https://github.com/tristantarrant/infinispan-playground-embedded-hotrod