[infinispan-issues] [JBoss JIRA] (ISPN-9222) Custom clientListener filters without a need to deploy java code to Infinispan server

Adrian Nistor (JIRA) issues at jboss.org
Wed May 30 04:25:01 EDT 2018


    [ https://issues.jboss.org/browse/ISPN-9222?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13584053#comment-13584053 ] 

Adrian Nistor edited comment on ISPN-9222 at 5/30/18 4:24 AM:
--------------------------------------------------------------

[~mposolda] Hi, you are getting very close to the treasure :) This is already doable since ispn 7 or 8, don't remember exactly. Please have a look at RemoteListenerWithDslFilterTest which uses hot rod with a client listener + a query to filter the events. You'll have to use protobuf encoding of course. Registering the listener is done via ClientEvents.addClientQueryListener which takes an org.infinispan.query.dsl.Query parameter. This query can either be built with the QueryBuilder using the fluent DSL or can be obtained using QueryFactory.create(..) with an Ickle query string.

ATM the method is in ClientEvents but could be moved to the remote cache interface in the future as you suggested.


was (Author: anistor):
[~mposolda] Hi, you are getting very close to the treasure :) This is already doable since ispn 7 or 8, don;t remember exactly. Please have a look at RemoteListenerWithDslFilterTest which uses hot rod with a client listener + a query to filter the events. You'll have to use protobuf encoding of course. Registering the listener is done via ClientEvents.addClientQueryListener which takes a org.infinispan.query.dsl.Query parameter. This query can either be built with the QueryBuilder using the fluent DSL or can obtained using QueryFactory.create(..) with an Ickle query string.

ATM the method is in ClientEvents but could be moved to the remote cache interface in the future as you suggested.

> Custom clientListener filters without a need to deploy java code to Infinispan server
> -------------------------------------------------------------------------------------
>
>                 Key: ISPN-9222
>                 URL: https://issues.jboss.org/browse/ISPN-9222
>             Project: Infinispan
>          Issue Type: Task
>          Components: Hot Rod
>    Affects Versions: 9.2.1.Final
>            Reporter: Marek Posolda
>
> 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:
> {code}
> public class UserEntity {
>     private String username;
>     private String email;
>     private String country;
> }
> {code}
> 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):
> {code}
> @org.infinispan.client.hotrod.annotation.ClientListener(filterFactoryName = "protobuf-factory")
> public class CustomLogListener {
>   ...
> }
> {code}
> 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:
> {code}
> remoteCache.addClientListener(listener, new String[] { "country.equals('cs')" }, null);
> {code}
> Interested just for users from Czech republic with emails from "@redhat.com":
> {code}
> remoteCache.addClientListener(listener, new String[] { "country.equals('cs') && email.endsWith('@redhat.com')" }, null);
> {code}



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the infinispan-issues mailing list