Re: Regards the ContinuousQuery and MutableCacheEntryListenerConfiguration
Hi Aaron! You close ContinuousQuery on this line: try (QueryCursor> 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, aa...@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 > -- > aa...@tophold.com > > > *From:* aa...@tophold.com > *Date:* 2017-11-29 19:22 > *To:* user > *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 query = new ContinuousQuery<>(); > query.setLocal(true); > query.setPageSize(1); > query.setTimeInterval(2_000); > final ScanQuery scanQuery = new ScanQuery<>(new > ScanDataFilter()); > scanQuery.setLocal(true); > query.setInitialQuery(scanQuery); > query.setLocalListener(new DataCreateUpdateListener()); > query.setRemoteFilterFactory(new CacheEntryEventFilterFactory()); > try (QueryCursor > cur = > accountCache.query(query)) { > for (Cache.Entry row : cur) { > processUpdate(row.getValue()); > } > } > > > This can not work after cache updates trigger > > MutableCacheEntryListenerConfiguration > mutableCacheEntryListenerConfiguration = new > MutableCacheEntryListenerConfiguration( > new Factory >() { > private static final long serialVersionUID = 5358838258503369206L; > @Override > public CacheEntryListener create() { > return new DataCreateUpdateListener(); > } > }, > new CacheEntryEventFilterFactory(), > false, > true > ); > ignite. AccountEntry>cache(AccountEntry.IG_CACHE_NAME).registerCacheEntryListener(mutableCacheEntryListenerConfiguration); > > > did I configuration something wrong? thanks for your advice! > > > Regards > Aaron > -- > aa...@tophold.com > >
Re: Regards the ContinuousQuery and MutableCacheEntryListenerConfiguration
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 aa...@tophold.com From: aa...@tophold.com Date: 2017-11-29 19:22 To: user Subject: Regards the ContinuousQuery and MutableCacheEntryListenerConfiguration 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 aa...@tophold.com
Regards the ContinuousQuery and MutableCacheEntryListenerConfiguration
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 ContinuousQueryquery = new ContinuousQuery<>(); query.setLocal(true); query.setPageSize(1); query.setTimeInterval(2_000); final ScanQuery scanQuery = new ScanQuery<>(new ScanDataFilter()); scanQuery.setLocal(true); query.setInitialQuery(scanQuery); query.setLocalListener(new DataCreateUpdateListener()); query.setRemoteFilterFactory(new CacheEntryEventFilterFactory()); try (QueryCursor > cur = accountCache.query(query)) { for (Cache.Entry row : cur) { processUpdate(row.getValue()); } } This can not work after cache updates trigger MutableCacheEntryListenerConfiguration mutableCacheEntryListenerConfiguration = new MutableCacheEntryListenerConfiguration( new Factory >() { private static final long serialVersionUID = 5358838258503369206L; @Override public CacheEntryListener create() { return new DataCreateUpdateListener(); } }, new CacheEntryEventFilterFactory(), false, true ); ignite. cache(AccountEntry.IG_CACHE_NAME).registerCacheEntryListener(mutableCacheEntryListenerConfiguration); did I configuration something wrong? thanks for your advice! Regards Aaron aa...@tophold.com