The GridGain Distributed Events feature allows applications to receive notifications about cache events occurring in the distributed grid environment. Developers can use the GridGain Distributed Events feature to get notified about remote tasks executions or any cache data changes within the cluster. Event notifications can be grouped together and sent in batches and/or timely intervals to reduce network traffic.
- Subscribe Local and Remote Listeners
- Enable and Disable any Event
- Provide Local and Remote Event Filters
- Group Event Notifications into Batches
Subscribe to remote notifications for cache data updates.
Ignite ignite = Ignition.ignite(); // Sample remote filter which only accepts events for keys // that are greater than or equal to 10. IgnitePredicate rmtLsnr = evt -> evt.key() >= 10; // Subscribe to specified cache events on all nodes that have cache running. ignite.events(ignite.cluster().forCacheNodes("cacheName")).remoteListen(null, rmtLsnr, EventType.EVT_CACHE_OBJECT_PUT, EventType.EVT_CACHE_OBJECT_READ, EventType.EVT_CACHE_OBJECT_REMOVED); // Get an instance of named cache. final IgniteCache<integer, string=""> cache = ignite.jcache("cacheName");</integer,> // Generate cache events. for (int i = 0; i < 20; i++) cache.put(i, Integer.toString(i));