Time Based Eviction in Hazelcast

后端 未结 1 490
走了就别回头了
走了就别回头了 2021-01-28 06:45

I am working on a requirement where i\'d have N hazelcast instances running in a cluster and also have kafka consumers running on all of them.

Now the ask is, each messa

相关标签:
1条回答
  • 2021-01-28 07:14

    You have to add a localEntryListener to your distributed map so that a member will only receive notifications for which it is an owner.

    e.g.

    if(map != null){
                map.addLocalEntryListener(new EntryAddedListener<Long, Long>() {
                    @Override
                    public void entryAdded(EntryEvent<Long, Long> event) {
                        log.info("LOCAL ENTRY ADDED : {} at {}", event, System.currentTimeMillis());
                    }
                });
    

    The above example is for the EntryAddedListener, you can similarly implement a EntryEvictedListener as well.

    0 讨论(0)
提交回复
热议问题