-
Enhancement
-
Resolution: Done
-
Major
-
7.1.0.Final
-
None
I want to have filter and convert take place in one step ie. do filtering and conversion applied to REMOTE LISTENERS in one step
a) I define CacheEventConverterFactory which implements CacheEventConverterFactory, Serializable
b) I register on the server org.infinispan.notifications.cachelistener.filter.CacheEventConverterFactory the cache event converter
which returns (CacheEventConverter<K, V, C>) new SharesDynamicFilterConverter(params);
c) I then define CacheEventFilterFactory which implements CacheEventFilterFactory, Serializable {
and returns(CacheEventFilter<K, V>) new SharesDynamicFilterConverter(params);
d) The CustomeDynamicFilterConverter extends AbstractCacheEventFilterConverter<String, Share, ShareProgress> implements Serializable {
and has the implementation of
public Share filterAndConvert(String key, Share oldValue, Metadata oldMetadata, Share newValue, Metadata newMetadata, EventType eventType) {
e) finally I define a listener binding it to the filter and converter
@ClientListener(filterFactoryName = "custom-dynamic-filter",
converterFactoryName = "custom-dynamic-converter",
includeCurrentState = true)
and register it along with params for the filter on the client side
cache.addClientListener(listener, new Object[]
The result of this is that certainly both accept and convert methods are run and both call the same filterAndConvert method on SharesDynamicFilterConverter
However, this is not desirable as I don't want 2 steps which will effectively do the same thing but a single step. TBH I am not happy with the solution but what I did (in absence of better understanding of how to combine the steps -NOTE there is no single Factory for both Converter and Filter and even if it did we would probably have to implement accept & convert inside so the end result would have been the same)
So what I did was to change the last step
ie.
e) finally I define a listener binding ONLY the converter
@ClientListener(converterFactoryName = "murex-dynamic-converter", includeCurrentState = true)
and register it along with params ONLY for the converter on the client side
cache.addClientListener(listener, null, new Object[]{"NYX", 50f}
);
This works as it actually does the filter during the convert step BUT is there another way and am I missing something? If not this would be a feature request
Martin Gencur <mgencur@redhat.com> changed the Status of bug 1211944 from ON_QA to VERIFIED