Here's another issue I've come across when trying to port our codebase from gridgain 4 to gridgain 6. Anyway, The intent is to wire in a one of our listeners to perform certain actions upon detection of a grid event (such as EVT_NODE_JOINED)
In the old code, we wire'd in our listener (gridNodeMonitor) as described by this xml snippet.
<beans profile="master">
<bean class="org.gridgain.grid.GridSpringBean">
<property name="configuration">
<bean parent="abstractGridConfiguration">
<property name="userAttributes">
<map merge="true">
<entry key="com.mycompany.master" value="true"/>
</map>
</property>
<property name="lifecycleBeans">
<list>
<ref bean="gridNodeMonitor"/>
</list>
</property>
<property name="localEventListeners">
<map>
<entry key-ref="gridNodeMonitor">
<list>
<util:constant static-field="org.gridgain.grid.GridEventType.EVT_NODE_JOINED"/>
<util:constant static-field="org.gridgain.grid.GridEventType.EVT_NODE_LEFT"/>
<util:constant static-field="org.gridgain.grid.GridEventType.EVT_NODE_FAILED"/>
<util:constant static-field="org.gridgain.grid.GridEventType.EVT_NODE_RECONNECTED"/>
</list>
</entry>
</map>
</property>
<property name="topologySpi">
<bean class="org.gridgain.grid.spi.topology.nodefilter.GridNodeFilterTopologySpi">
<property name="filter">
<bean class="com.mycompany.enterprise.gridgain.license.GridNodeMonitorImpl"
factory-method="createTopologyFilter">
<constructor-arg ref="gridNodeMonitor"/>
</bean>
</property>
</bean>
</property>
<property name="cacheConfiguration">
<bean class="org.gridgain.grid.cache.GridCacheConfigurationAdapter"/>
</property>
</bean>
</property>
</bean>
</beans>
In the new code, the configuration schema has changed and this is what I've ported it to (localEventListener isn't a valid property anymore). I'm guessing my issue is that I haven't specified a listener to monitor the events. How should I configure this? I should note that in any case, GridGain works correctly, i.e. jobs are being distributed to the correct nodes, it's just the listener that isn't correctly being registered.
Thanks
<beans profile="master">
<bean class="org.gridgain.grid.GridSpringBean">
<property name="configuration">
<bean parent="abstractGridConfiguration">
<property name="userAttributes">
<map merge="true">
<entry key="com.mycompany.master" value="true"/>
</map>
</property>
<property name="lifecycleBeans">
<list>
<ref bean="gridNodeMonitor"/>
</list>
</property>
<property name="includeEventTypes">
<list>
<util:constant static-field="org.gridgain.grid.events.GridEventType.EVT_NODE_JOINED"/>
<util:constant static-field="org.gridgain.grid.events.GridEventType.EVT_NODE_LEFT"/>
<util:constant static-field="org.gridgain.grid.events.GridEventType.EVT_NODE_FAILED"/>
<util:constant static-field="org.gridgain.grid.events.GridEventType.EVT_NODE_RECONNECTED"/>
</list>
</property>
<property name="cacheConfiguration">
<bean class="org.gridgain.grid.cache.GridCacheConfiguration"/>
</property>
</bean>
</property>
</bean>
</beans>
Your configuration looks correct to me. Have you added a listener in the code, like so:
GridPredicate<GridTaskEvent> lsnr = new GridPredicate<GridTaskEvent>() {
@Override public boolean apply(GridTaskEvent evt) {
// Process event.
...
return true; // Return true to continue listening.
}
};
// Register event listener for all local task execution events.
g.events().localListen(lsnr, EVTS_TASK_EXECUTION);
Also, you should take a look at event examples shipped with GridGain: