ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nikolai Tikhonov <ntikho...@apache.org>
Subject Re: Regards the ContinuousQuery and MutableCacheEntryListenerConfiguration
Date Fri, 01 Dec 2017 15:25:34 GMT
Hi Aaron!

You close ContinuousQuery on this line:

try (QueryCursor<Cache.Entry<String, AccountEntry>> cur =
accountCache.query(query)) {

When you call *QueryCursor#close()* method this listener stops receiving
updates. Just remove `*try*` and it will work as you expected.

On Wed, Nov 29, 2017 at 2:56 PM, aaron@tophold.com <aaron@tophold.com>
wrote:

>
> BTW I Use the SQL to update the cache then can not trigger the ContinuousQuery
>  while If I update one by one seem can work.
>
> Is this the reason?
>
> SqlFieldsQuery update = new SqlFieldsQuery(UPDATE).setArgs(Utils.utcEpochMills())
>         .setTimeout(20, TimeUnit.SECONDS)
>         .setCollocated(true)
>         .setLocal(true);
>
>
> Regards
> Aaron
> ------------------------------
> aaron@tophold.com
>
>
> *From:* aaron@tophold.com
> *Date:* 2017-11-29 19:22
> *To:* user <user@ignite.apache.org>
> *Subject:* Regards the ContinuousQuery and MutableCacheEntryListenerConfi
> guration
> hi All,
>
> We use the exactly same configuration  with same CacheEntryListener  and  CacheEntryEventFilter
> in both ContinuousQuery  and  MutableCacheEntryListenerConfiguration
>
> But the ContinuousQuery  seem never continues trigger any events while
> the the MutableCacheEntryListenerConfiguration can continues trigger
> things.
>
> Also  If in the ContinuousQuery  no interface to set include old value
> disable.
>
>
> This can not work even after the cache update
>
> final ContinuousQuery<String, AccountEntry> query = new ContinuousQuery<>();
> query.setLocal(true);
> query.setPageSize(1);
> query.setTimeInterval(2_000);
> final ScanQuery<String, AccountEntry> scanQuery = new ScanQuery<>(new ScanDataFilter());
> scanQuery.setLocal(true);
> query.setInitialQuery(scanQuery);
> query.setLocalListener(new DataCreateUpdateListener());
> query.setRemoteFilterFactory(new CacheEntryEventFilterFactory());
> try (QueryCursor<Cache.Entry<String, AccountEntry>> cur = accountCache.query(query))
{
>     for (Cache.Entry<String, AccountEntry> row : cur) {
>         processUpdate(row.getValue());
>     }
> }
>
>
> This can not work after cache updates trigger
>
> MutableCacheEntryListenerConfiguration<String, AccountEntry> mutableCacheEntryListenerConfiguration
= new MutableCacheEntryListenerConfiguration(
>         new Factory<CacheEntryListener<String, AccountEntry>>() {
>             private static final long serialVersionUID = 5358838258503369206L;
>             @Override
>             public CacheEntryListener<String, AccountEntry> create() {
>                 return new DataCreateUpdateListener();
>             }
>         },
>         new CacheEntryEventFilterFactory(),
>         false,
>         true
> );
> ignite.<String, AccountEntry>cache(AccountEntry.IG_CACHE_NAME).registerCacheEntryListener(mutableCacheEntryListenerConfiguration);
>
>
> did I configuration something wrong?  thanks for your advice!
>
>
> Regards
> Aaron
> ------------------------------
> aaron@tophold.com
>
>

Mime
View raw message