use of org.apache.geode.cache.asyncqueue.AsyncEventListener in project geode by apache.
the class PDXAsyncEventQueueDUnitTest method createSerialAsyncEventQueue.
protected void createSerialAsyncEventQueue(VM vm, final boolean persistent) {
SerializableCallable createSystem = new SerializableCallable() {
public Object call() throws Exception {
Cache cache = getCache();
AsyncEventQueue sender = cache.createAsyncEventQueueFactory().setBatchSize(2).setBatchTimeInterval(1000).setBatchConflationEnabled(false).setPersistent(persistent).create("queue", new AsyncEventListener() {
@Override
public void close() {
// TODO Auto-generated method stub
}
@Override
public boolean processEvents(List<AsyncEvent> events) {
// do nothing
return true;
}
});
return null;
}
};
vm.invoke(createSystem);
}
use of org.apache.geode.cache.asyncqueue.AsyncEventListener in project geode by apache.
the class WANTestBase method validateAsyncEventListener.
public static void validateAsyncEventListener(String asyncQueueId, final int expectedSize) {
AsyncEventListener theListener = null;
Set<AsyncEventQueue> asyncEventQueues = cache.getAsyncEventQueues();
for (AsyncEventQueue asyncQueue : asyncEventQueues) {
if (asyncQueueId.equals(asyncQueue.getId())) {
theListener = asyncQueue.getAsyncEventListener();
}
}
final Map eventsMap = ((MyAsyncEventListener) theListener).getEventsMap();
assertNotNull(eventsMap);
Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> assertEquals("Expected map entries: " + expectedSize + " but actual entries: " + eventsMap.size(), expectedSize, eventsMap.size()));
}
use of org.apache.geode.cache.asyncqueue.AsyncEventListener in project geode by apache.
the class WANTestBase method getAsyncEventListenerMapSize.
public static int getAsyncEventListenerMapSize(String asyncEventQueueId) {
AsyncEventListener theListener = null;
Set<AsyncEventQueue> asyncEventQueues = cache.getAsyncEventQueues();
for (AsyncEventQueue asyncQueue : asyncEventQueues) {
if (asyncEventQueueId.equals(asyncQueue.getId())) {
theListener = asyncQueue.getAsyncEventListener();
}
}
final Map eventsMap = ((MyAsyncEventListener) theListener).getEventsMap();
assertNotNull(eventsMap);
LogWriterUtils.getLogWriter().info("The events map size is " + eventsMap.size());
return eventsMap.size();
}
Aggregations