This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.infinispan.client.hotrod.annotation.*; | |
| import org.infinispan.client.hotrod.event.*; | |
| @ClientListener(converterFactoryName = "value-added-converter-factory") | |
| public class CustomEventLogListener { | |
| @ClientCacheEntryCreated | |
| @ClientCacheEntryModified | |
| @ClientCacheEntryRemoved | |
| public void handleRemoteEvent(ClientCacheEntryCustomEvent<ValueAddedEvent> e) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sample.ValueAddedConverterFactory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ClientCacheEntryCreatedEvent(key=1,dataVersion=1) | |
| ClientCacheEntryModifiedEvent(key=1,dataVersion=2) | |
| ClientCacheEntryCreatedEvent(key=2,dataVersion=3) | |
| ClientCacheEntryModifiedEvent(key=2,dataVersion=4) | |
| ClientCacheEntryRemovedEvent(key=1) | |
| ClientCacheEntryRemovedEvent(key=2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package sample; | |
| import java.io.Serializable; | |
| import org.infinispan.notifications.cachelistener.filter.*; | |
| import org.infinispan.metadata.*; | |
| @NamedFactory(name = "basic-filter-factory") | |
| public class BasicKeyValueFilterFactory implements CacheEventFilterFactory { | |
| @Override public CacheEventFilter<Integer, String> getFilter(final Object[] params) { | |
| return new BasicKeyValueFilter(params); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.infinispan.client.hotrod.*; | |
| RemoteCacheManager rcm = new RemoteCacheManager(); | |
| RemoteCache<Integer, String> cache = rcm.getCache(); | |
| BasicFilteredEventLogListener listener = new BasicFilteredEventLogListener(); | |
| try { | |
| cache.addClientListener(listener, new Object[]{3}, null); // <- Filter parameter passed | |
| cache.putIfAbsent(1, "one"); | |
| cache.replace(1, "new-one"); | |
| cache.putIfAbsent(2, "two"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ClientCacheEntryCreatedEvent(key=1,dataVersion=1) | |
| ClientCacheEntryModifiedEvent(key=1,dataVersion=2) | |
| ClientCacheEntryCreatedEvent(key=3,dataVersion=5) | |
| ClientCacheEntryModifiedEvent(key=3,dataVersion=6) | |
| ClientCacheEntryRemovedEvent(key=1) | |
| ClientCacheEntryRemovedEvent(key=3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.infinispan.client.hotrod.*; | |
| RemoteCacheManager rcm = new RemoteCacheManager(); | |
| RemoteCache<Integer, String> cache = rcm.getCache(); | |
| BasicFilteredEventLogListener listener = new BasicFilteredEventLogListener(); | |
| try { | |
| cache.addClientListener(listener); | |
| cache.putIfAbsent(1, "one"); | |
| cache.replace(1, "new-one"); | |
| cache.putIfAbsent(2, "two"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @org.infinispan.client.hotrod.annotation.ClientListener(filterFactoryName = "basic-filter-factory") | |
| public class BasicFilteredEventLogListener extends EventLogListener {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sample.BasicKeyValueFilterFactory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package sample; | |
| import java.io.Serializable; | |
| import org.infinispan.notifications.cachelistener.filter.*; | |
| import org.infinispan.metadata.*; | |
| @NamedFactory(name = "basic-filter-factory") | |
| public class BasicKeyValueFilterFactory implements CacheEventFilterFactory { | |
| @Override public CacheEventFilter<Integer, String> getFilter(final Object[] params) { | |
| return new BasicKeyValueFilter(); |