Kamal,

You should enable these event type in configuration. See
IgniteConfiguration.setIncludeEventTypes(int
...) method.

Vladimir.

On Mon, Feb 29, 2016 at 12:00 PM, Kamal C <kamaltar...@gmail.com> wrote:

> Hi,
>
>     I have a replicated ignite cache with 3 nodes. I want to listen for
> data rebalance notifications in all the nodes whenever a new node joined /
> left the cluster.
>
> Using Ignite Events, I'd tried to register for cache re-balance
> notifications. But, I'm unable to receive any notifications.
>
> CacheConfiguration<String, Integer> cacheCfg = new
> CacheConfiguration<>("cache_name");
> cacheCfg.setCacheMode(CacheMode.REPLICATED);
>
>
> IgniteCache<String, Boolean> cache = ignite.getOrCreateCache(cacheCfg);
>
> ignite.events(ignite.cluster().forCacheNodes("cache_name")).localListen(
>     new IgnitePredicate<CacheRebalanacingEvent>() {
>
>     private static final long serialVersionUID = 1L;
>
>                     @Override
>                     public boolean apply(CacheRebalanacingEvent e)
>                     {
>                         if(e.cacheName.equals("cache_name")) {
>                             logger.info("Received rebalancing Event :
> {}", e);
>                         }
>                         return true;
>                     }
>                 }, EventType.EVTS_CACHE_REBALANCE);
>
>
>
>
> *In logs,* WARN [2016-02-29 13:01:31,661] [main] (Log4JLogger.java:480) -
> Added listener for disabled event type: CACHE_REBALANCE_STARTED
>  WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
> listener for disabled event type: CACHE_REBALANCE_STOPPED
>  WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
> listener for disabled event type: CACHE_REBALANCE_PART_LOADED
>  WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
> listener for disabled event type: CACHE_REBALANCE_PART_UNLOADED
>  WARN [2016-02-29 13:01:31,662] [main] (Log4JLogger.java:480) - Added
> listener for disabled event type: CACHE_REBALANCE_OBJECT_LOADED
>  WARN [2016-02-29 13:01:31,663] [main] (Log4JLogger.java:480) - Added
> listener for disabled event type: CACHE_REBALANCE_OBJECT_UNLOADED
>  WARN [2016-02-29 13:01:31,663] [main] (Log4JLogger.java:480) - Added
> listener for disabled event type: CACHE_REBALANCE_PART_DATA_LOST
>
>
> How to receive REBALANCE_STOPPED notification ?
>
> --
> Kamal
>
>

Reply via email to