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

Custom clientListener filters without a need to deploy java code to Infinispan server

XMLWordPrintable

      Currently JDG has a way to register client listeners for the remote HotRod events. There are also ways to filter the events, so that client listener doesn't receive the filtered events, which it's not interested in. But it looks that filtering currently requires custom code with CacheEventFilterFactory to be available on JDG server side as described in https://access.redhat.com/documentation/en-us/red_hat_jboss_data_grid/7.2/html-single/developer_guide/#filtering_remote_events .

      I was wondering if it's possible to have custom filter, which is able to somehow filter fields of custom objects without a need to deploy custom code to the Infinispan/JDG server? Both the object and CacheEventFilterFactory to not be required on JDG side. AFAIK the protobuf schema could be used to query custom objects on JDG server side without having the code of the objects available on the JDG side? So iwas thinking about something similar.

      More details: Let's assume that on HotRod client side, I have entity like this:

      public class UserEntity {
      
          private String username;
          private String email;
          private String country;
      
      }
      

      I will be able to create client listener like this (I don't need to deploy "protobuf-factory". It will be available on JDG out of the box):

      @org.infinispan.client.hotrod.annotation.ClientListener(filterFactoryName = "protobuf-factory")
      public class CustomLogListener {
        ...
      }
      

      Then I will be able to use the examples like this to register client listener on client side (just an example how can the filtering "psudo-language" look like):

      Interested just for users from Czech republic:

      remoteCache.addClientListener(listener, new String[] { "country.equals('cs')" }, null);
      

      Interested just for users from Czech republic with emails from "@redhat.com":

      remoteCache.addClientListener(listener, new String[] { "country.equals('cs') && email.endsWith('@redhat.com')" }, null);
      

            dvagnero@redhat.com Dominika Borges
            mposolda@redhat.com Marek Posolda
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: