Issues with listening on Events as a client node
Hello,
I am trying to listen on some events, but I keep on getting NoSerilization Exception, and if I implement Serializable, I get a ClassNotFoundException.
I added the following property inside the XML file:
<property name="includeEventTypes">
<list>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_EXPIRED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_CLUSTER_ACTIVATED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_CLUSTER_DEACTIVATED"/>
</list>
</property>
In my Java class, I added the following method:
node.events().remoteListen(addExpiredQuote(), null, EventType.EVT_CACHE_OBJECT_EXPIRED);
Every time, it reaches this point, it throws the exceptions above.
I am creating a client node, that creates a cache in the cluster, and wants to listen on this event.
I had the following: node.cluster().forClientNodes(GRID_GAIN_QUOTE_CACHE)
Unfortunately, it starts up and I have a break point inside the function that should be called, but it never goes there when the object is evicted.
This is the cache configuration:
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="RFQ_REST_QUOTE_CACHE"/>
<property name="cacheMode" value="REPLICATED"/>
<property name="rebalanceMode" value="SYNC"/>
<property name="partitionLossPolicy" value="READ_ONLY_SAFE"/>
<property name="eagerTtl" value="true"/>
<property name="expiryPolicyFactory">
<bean class="javax.cache.expiry.CreatedExpiryPolicy" factory-method="factoryOf">
<constructor-arg>
<bean class="javax.cache.expiry.Duration">
<constructor-arg value="SECONDS"/>
<constructor-arg value="30"/>
</bean>
</constructor-arg>
</bean>
</property>
</bean>
Can you please help?
Hi @m-yassine1,
Could you please share the implementation of your local listener and provide a full stack trace of the mentioned exceptions? It would be great if you could upload your project to GitHub and provide a link.
By the way, node.cluster().forClientNodes(GRID_GAIN_QUOTE_CACHE) returns a cluster group for all client nodes that access the cache with the specified name. Client nodes do not store any data and so do not fire events like EVT_CACHE_OBJECT_EXPIRED.