Search code examples
spring-data-gemfiregeode

Even after setting batchsize, AEQ process events method triggering for every call


I have configured batch size in AsyncEventQueueFactory. But when I update region data, processEvents() is called every time. I want to update db after some set of time interval. Am I missing any thing here or still I need to do any configuration?

Config:

    Cache localcache = new CacheFactory().create();
    AsyncEventQueueFactory factory = localcache.createAsyncEventQueueFactory();
    factory.setPersistent(true);
    factory.setParallel(false);
    factory.setBatchSize(2);
    factory.setBatchTimeInterval(2);
    AsyncEventListener listener = new GemfireAsyncListener(cache);
    AsyncEventQueue asyncQueue = factory.create("sampleQueue", listener);

Solution

  • The dispatcher will process a batch of messages from the queue when either the batch size or the time interval is reached. In your particular case, you have configured the batch interval as 2 milliseconds, that's probably the reason why the events get processed almost inmediatly.

    Hope this helps. Cheers.