]
Donald Naro updated ISPN-9222:
------------------------------
Sprint: DataGrid Sprint #39
Custom clientListener filters without a need to deploy java code to
Infinispan server
-------------------------------------------------------------------------------------
Key: ISPN-9222
URL:
https://issues.redhat.com/browse/ISPN-9222
Project: Infinispan
Issue Type: Enhancement
Components: Documentation, Hot Rod
Affects Versions: 9.2.1.Final
Reporter: Marek Posolda
Assignee: Donald Naro
Priority: Major
Labels: redhat-summit-18
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...
.
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 "(a)redhat.com":
{code}
remoteCache.addClientListener(listener, new String[] { "country.equals('cs')
&& email.endsWith('(a)redhat.com')" }, null);
{code}