Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-5222

Perform Remote Filtering/Conversion in a single step

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Done
    • Major
    • 7.2.0.Final
    • 7.1.0.Final
    • Listeners
    • None

    Description

      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[]

      {"NYX", 50f}, null);


      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

      Attachments

        Activity

          People

            rh-ee-galder Galder ZamarreƱo
            rhn-gps-stkousso STYLIANOS Kousouris
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: