use of org.apache.geode.cache.asyncqueue.AsyncEventQueue in project geode by apache.
the class MyGatewayEventSubstitutionFilter method validateAsyncEventQueueAttributes.
/**
* Validate whether all the attributes set on AsyncEventQueueFactory are set on the sender
* underneath the AsyncEventQueue.
*/
public static void validateAsyncEventQueueAttributes(String asyncChannelId, int maxQueueMemory, int batchSize, int batchTimeInterval, boolean isPersistent, String diskStoreName, boolean isDiskSynchronous, boolean batchConflationEnabled) {
AsyncEventQueue theChannel = null;
Set<AsyncEventQueue> asyncEventChannels = cache.getAsyncEventQueues();
for (AsyncEventQueue asyncChannel : asyncEventChannels) {
if (asyncChannelId.equals(asyncChannel.getId())) {
theChannel = asyncChannel;
}
}
GatewaySender theSender = ((AsyncEventQueueImpl) theChannel).getSender();
assertEquals("maxQueueMemory", maxQueueMemory, theSender.getMaximumQueueMemory());
assertEquals("batchSize", batchSize, theSender.getBatchSize());
assertEquals("batchTimeInterval", batchTimeInterval, theSender.getBatchTimeInterval());
assertEquals("isPersistent", isPersistent, theSender.isPersistenceEnabled());
assertEquals("diskStoreName", diskStoreName, theSender.getDiskStoreName());
assertEquals("isDiskSynchronous", isDiskSynchronous, theSender.isDiskSynchronous());
assertEquals("batchConflation", batchConflationEnabled, theSender.isBatchConflationEnabled());
}
use of org.apache.geode.cache.asyncqueue.AsyncEventQueue in project geode by apache.
the class MyGatewayEventSubstitutionFilter method pauseAsyncEventQueue.
public static void pauseAsyncEventQueue(String asyncChannelId) {
AsyncEventQueue theChannel = null;
Set<AsyncEventQueue> asyncEventChannels = cache.getAsyncEventQueues();
for (AsyncEventQueue asyncChannel : asyncEventChannels) {
if (asyncChannelId.equals(asyncChannel.getId())) {
theChannel = asyncChannel;
}
}
((AsyncEventQueueImpl) theChannel).getSender().pause();
}
use of org.apache.geode.cache.asyncqueue.AsyncEventQueue in project geode by apache.
the class MyGatewayEventSubstitutionFilter method resumeAsyncEventQueue.
public static void resumeAsyncEventQueue(String asyncQueueId) {
AsyncEventQueue theQueue = null;
Set<AsyncEventQueue> asyncEventChannels = cache.getAsyncEventQueues();
for (AsyncEventQueue asyncChannel : asyncEventChannels) {
if (asyncQueueId.equals(asyncChannel.getId())) {
theQueue = asyncChannel;
}
}
((AsyncEventQueueImpl) theQueue).getSender().resume();
}
use of org.apache.geode.cache.asyncqueue.AsyncEventQueue in project geode by apache.
the class MyGatewayEventSubstitutionFilter method createAsyncEventQueue.
public static void createAsyncEventQueue(String asyncChannelId, boolean isParallel, Integer maxMemory, Integer batchSize, boolean isConflation, boolean isPersistent, String diskStoreName, boolean isDiskSynchronous, final AsyncEventListener asyncEventListener) {
createDiskStore(asyncChannelId, diskStoreName);
AsyncEventQueueFactory factory = getInitialAsyncEventQueueFactory(isParallel, maxMemory, batchSize, isPersistent, diskStoreName);
factory.setDiskSynchronous(isDiskSynchronous);
factory.setBatchConflationEnabled(isConflation);
// set dispatcher threads
factory.setDispatcherThreads(numDispatcherThreadsForTheRun);
// Set GatewayEventSubstitutionFilter
AsyncEventQueue asyncChannel = factory.create(asyncChannelId, asyncEventListener);
}
use of org.apache.geode.cache.asyncqueue.AsyncEventQueue in project geode by apache.
the class MyGatewayEventSubstitutionFilter method checkAsyncEventQueueConflatedStats.
public static void checkAsyncEventQueueConflatedStats(String asyncEventQueueId, final int eventsConflated) {
Set<AsyncEventQueue> queues = cache.getAsyncEventQueues();
AsyncEventQueue queue = null;
for (AsyncEventQueue q : queues) {
if (q.getId().equals(asyncEventQueueId)) {
queue = q;
break;
}
}
final AsyncEventQueueStats statistics = ((AsyncEventQueueImpl) queue).getStatistics();
assertEquals(eventsConflated, statistics.getEventsNotQueuedConflated());
}
Aggregations