Hello!
No, updating local set will not be sent over to the remote node, but on the
remote node you can probably update it from your filter:
qry.setRemoteFilterFactory(new Factory<CacheEntryEventFilter<Integer,
String>>() {
@Override public CacheEntryEventFilter<Integer, String>
create() {
return new CacheEntryEventFilter<Integer, String>()
{
@Override public boolean
evaluate(CacheEntryEvent<? extends Integer, ? extends String> e) {
// This method is implemented and called
on remote node
set = updateSetIfNeeded(set);
return set.contains(e.getKey());
}
};
}
});
Please note that it is not advisable to do cache operations from filter, so
you should probably do that in background by e.g. registering a service.
Regards,
--
Ilya Kasnacheev
вт, 26 мая 2020 г. в 11:31, zork <[email protected]>:
> Hi,
> Sorry but I could not get it to work.
>
> The standard way of defining a remote filter as shown in sample repo is
> something like:
>
> qry.setRemoteFilterFactory(new Factory<CacheEntryEventFilter<Integer,
> String>>() {
> @Override public CacheEntryEventFilter<Integer, String>
> create() {
> return new CacheEntryEventFilter<Integer, String>()
> {
> @Override public boolean
> evaluate(CacheEntryEvent<? extends Integer, ? extends String> e) {
> return e.getKey() > 10;
> }
> };
> }
> });
>
> In the above, instead of having *10* constant, I need to have a HashSet
> from
> which I can check if the updated key exists in it or not (see the snippet
> below) And I need the changes in the HashSet to be reflected in the filter.
> However it's not making sense to me because the HashSet which is modified
> is
> on one node while the filter is on another node so I expect the remote node
> would already have it serialized when the filter was first created and it
> would not change even if the set changes in the local node.
>
> HashSet<Integer> = new HashSet<>();
> set.add(20);
> qry.setRemoteFilterFactory(new Factory<CacheEntryEventFilter<Integer,
> String>>() {
> @Override public CacheEntryEventFilter<Integer, String>
> create() {
> return new CacheEntryEventFilter<Integer, String>()
> {
> @Override public boolean
> evaluate(CacheEntryEvent<? extends Integer, ? extends String> e) {
> return set.contains(e.getKey());
> }
> };
> }
> });
> set.add(10) // would this actually change the filter on remote node?
>
> Perhaps I'm missing something very obvious here. Please help me identify
> it.
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>