Eclipselink cache coordination in a Wildfly Cluster
ijm3 Jul 11, 2019 12:41 PMHi all,
I've spent the last day or so trying to set up cache coordination between two Wildfly instances on separate machines.
I managed to set this up successfully when running a domain with multiple servers all on one machine, but am now trying to achieve the same using a master/slave setup.
My slave instance is successfully finding the master and deploying as expected but when I update an object the other side does not reflect these changes, nor is there any logging to suggest what the issue might be.
I found the following post, which suggested setting the jms.host, but I've had little luck with this: caching - How to set up Eclipselink cache coordination with Wildfly - Stack Overflow
My connection-factory is just using the http-socket (port 80 in my case) so I've tried setting the jms.host to the ip of each machine + :80 as well as 127.0.0.1:80 but not had any luck
If anyone has any suggestions, or if I've missed something obvious, I'd appreciate it.
My persistence.xml is as follows:
<?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd" version="2.1"> <persistence-unit name="AppPu"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> <jta-data-source>demo.datasource</jta-data-source> <exclude-unlisted-classes>false</exclude-unlisted-classes> <shared-cache-mode>DISABLE_SELECTIVE</shared-cache-mode> <properties> <property name="eclipselink.persistence-context.flush-mode" value="commit"/> <property name="eclipselink.jdbc.batch-writing" value="jdbc"/> <property name="eclipselink.jdbc.batch-writing.size" value="500"/> <property name="eclipselink.session-event-listener" value="com.demo.app.common.eclipselink.AppGeometryInitializer"/> <property name="eclipselink.cache.coordination.protocol" value="jms" /> <property name="eclipselink.cache.coordination.jms.topic" value="java:jboss/exported/jms/EclipseLinkCacheTopic" /> <property name="eclipselink.cache.coordination.jms.factory" value="java:jboss/exported/jms/EclipseLinkCacheConnectionFactory" /> <property name="eclipselink.cache.coordination.jms.reuse-topic-publisher" value="true" /> <!--<property name="eclipselink.cache.coordination.jms.host" value="XX.XX.XXX.XX:80" />--> </properties> </persistence-unit> </persistence>
In my domain.xml, I have set up the topic and factory in my messaging-activemq subsystem like so:
<jms-topic name="EclipseLinkCacheTopic" entries="java:jboss/exported/jms/EclipseLinkCacheTopic"/> <connection-factory name="EclipseLinkCacheConnectionFactory" entries="java:jboss/exported/jms/EclipseLinkCacheConnectionFactory" connectors="http-connector" ha="true" block-on-acknowledge="true" reconnect-attempts="-1"/>
If any further information would help let me know.
Cheers.