use of org.apache.geode.cache.wan.GatewaySenderFactory in project geode by apache.
the class CacheXml70GatewayDUnitTest method testParallelGatewaySender.
@Test
public void testParallelGatewaySender() throws Exception {
getSystem();
CacheCreation cache = new CacheCreation();
GatewaySenderFactory gatewaySenderFactory = cache.createGatewaySenderFactory();
gatewaySenderFactory.setParallel(true);
gatewaySenderFactory.setDispatcherThreads(13);
gatewaySenderFactory.setManualStart(true);
gatewaySenderFactory.setSocketBufferSize(1234);
gatewaySenderFactory.setSocketReadTimeout(1050);
gatewaySenderFactory.setBatchConflationEnabled(false);
gatewaySenderFactory.setBatchSize(88);
gatewaySenderFactory.setBatchTimeInterval(9);
gatewaySenderFactory.setPersistenceEnabled(true);
gatewaySenderFactory.setDiskStoreName("LNSender");
gatewaySenderFactory.setDiskSynchronous(true);
gatewaySenderFactory.setMaximumQueueMemory(211);
gatewaySenderFactory.setAlertThreshold(35);
GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
gatewaySenderFactory.addGatewayEventFilter(myEventFilter1);
GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
gatewaySenderFactory.addGatewayTransportFilter(myStreamFilter1);
GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
gatewaySenderFactory.addGatewayTransportFilter(myStreamFilter2);
GatewaySender parallelGatewaySender = gatewaySenderFactory.create("LN", 2);
testXml(cache);
Cache c = getCache();
assertNotNull(c);
Set<GatewaySender> sendersOnCache = c.getGatewaySenders();
for (GatewaySender sender : sendersOnCache) {
assertEquals(true, sender.isParallel());
validateGatewaySender(parallelGatewaySender, sender);
}
}
use of org.apache.geode.cache.wan.GatewaySenderFactory in project geode by apache.
the class CacheXml70GatewayDUnitTest method testSerialGatewaySender.
@Test
public void testSerialGatewaySender() throws Exception {
getSystem();
CacheCreation cache = new CacheCreation();
GatewaySenderFactory gatewaySenderFactory = cache.createGatewaySenderFactory();
gatewaySenderFactory.setParallel(false);
gatewaySenderFactory.setManualStart(true);
gatewaySenderFactory.setSocketBufferSize(124);
gatewaySenderFactory.setSocketReadTimeout(1000);
gatewaySenderFactory.setBatchConflationEnabled(false);
gatewaySenderFactory.setBatchSize(100);
gatewaySenderFactory.setBatchTimeInterval(10);
gatewaySenderFactory.setPersistenceEnabled(true);
gatewaySenderFactory.setDiskStoreName("LNSender");
gatewaySenderFactory.setDiskSynchronous(true);
gatewaySenderFactory.setMaximumQueueMemory(200);
gatewaySenderFactory.setAlertThreshold(30);
GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
gatewaySenderFactory.addGatewayEventFilter(myEventFilter1);
GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
gatewaySenderFactory.addGatewayTransportFilter(myStreamFilter1);
GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
gatewaySenderFactory.addGatewayTransportFilter(myStreamFilter2);
GatewaySender serialGatewaySender = gatewaySenderFactory.create("LN", 2);
RegionAttributesCreation attrs = new RegionAttributesCreation();
attrs.addGatewaySenderId(serialGatewaySender.getId());
cache.createRegion("UserRegion", attrs);
testXml(cache);
Cache c = getCache();
assertNotNull(c);
Set<GatewaySender> sendersOnCache = c.getGatewaySenders();
for (GatewaySender sender : sendersOnCache) {
assertEquals(false, sender.isParallel());
validateGatewaySender(serialGatewaySender, sender);
}
}
use of org.apache.geode.cache.wan.GatewaySenderFactory in project geode by apache.
the class UpdateVersionDUnitTest method createSender.
public static void createSender(String dsName, int remoteDsId, boolean isParallel, Integer maxMemory, Integer batchSize, boolean isConflation, boolean isPersistent, GatewayEventFilter filter, boolean isManualStart) {
File persistentDirectory = new File(dsName + "_disk_" + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
persistentDirectory.mkdir();
DiskStoreFactory dsf = cache.createDiskStoreFactory();
File[] dirs1 = new File[] { persistentDirectory };
if (isParallel) {
GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
gateway.setParallel(true);
gateway.setMaximumQueueMemory(maxMemory);
gateway.setBatchSize(batchSize);
gateway.setManualStart(isManualStart);
((InternalGatewaySenderFactory) gateway).setLocatorDiscoveryCallback(new MyLocatorCallback());
if (filter != null) {
gateway.addGatewayEventFilter(filter);
}
if (isPersistent) {
gateway.setPersistenceEnabled(true);
gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName).getName());
} else {
DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
gateway.setDiskStoreName(store.getName());
}
gateway.setBatchConflationEnabled(isConflation);
gateway.create(dsName, remoteDsId);
} else {
GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
gateway.setMaximumQueueMemory(maxMemory);
gateway.setBatchSize(batchSize);
gateway.setManualStart(isManualStart);
((InternalGatewaySenderFactory) gateway).setLocatorDiscoveryCallback(new MyLocatorCallback());
if (filter != null) {
gateway.addGatewayEventFilter(filter);
}
gateway.setBatchConflationEnabled(isConflation);
if (isPersistent) {
gateway.setPersistenceEnabled(true);
gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName).getName());
} else {
DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
gateway.setDiskStoreName(store.getName());
}
gateway.create(dsName, remoteDsId);
}
}
use of org.apache.geode.cache.wan.GatewaySenderFactory in project geode by apache.
the class WANTestBase method createSenderWithDiskStore.
public static String createSenderWithDiskStore(String dsName, int remoteDsId, boolean isParallel, Integer maxMemory, Integer batchSize, boolean isConflation, boolean isPersistent, GatewayEventFilter filter, String dsStore, boolean isManualStart) {
File persistentDirectory = null;
if (dsStore == null) {
persistentDirectory = new File(dsName + "_disk_" + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
} else {
persistentDirectory = new File(dsStore);
}
LogWriterUtils.getLogWriter().info("The ds is : " + persistentDirectory.getName());
persistentDirectory.mkdir();
DiskStoreFactory dsf = cache.createDiskStoreFactory();
File[] dirs1 = new File[] { persistentDirectory };
if (isParallel) {
GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
gateway.setParallel(true);
gateway.setMaximumQueueMemory(maxMemory);
gateway.setBatchSize(batchSize);
gateway.setManualStart(isManualStart);
// set dispatcher threads
gateway.setDispatcherThreads(numDispatcherThreadsForTheRun);
((InternalGatewaySenderFactory) gateway).setLocatorDiscoveryCallback(new MyLocatorCallback());
if (filter != null) {
gateway.addGatewayEventFilter(filter);
}
if (isPersistent) {
gateway.setPersistenceEnabled(true);
String dsname = dsf.setDiskDirs(dirs1).create(dsName).getName();
gateway.setDiskStoreName(dsname);
LogWriterUtils.getLogWriter().info("The DiskStoreName is : " + dsname);
} else {
DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
gateway.setDiskStoreName(store.getName());
LogWriterUtils.getLogWriter().info("The ds is : " + store.getName());
}
gateway.setBatchConflationEnabled(isConflation);
gateway.create(dsName, remoteDsId);
} else {
GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
gateway.setMaximumQueueMemory(maxMemory);
gateway.setBatchSize(batchSize);
gateway.setManualStart(isManualStart);
// set dispatcher threads
gateway.setDispatcherThreads(numDispatcherThreadsForTheRun);
((InternalGatewaySenderFactory) gateway).setLocatorDiscoveryCallback(new MyLocatorCallback());
if (filter != null) {
gateway.addGatewayEventFilter(filter);
}
gateway.setBatchConflationEnabled(isConflation);
if (isPersistent) {
gateway.setPersistenceEnabled(true);
gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName).getName());
} else {
DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
gateway.setDiskStoreName(store.getName());
}
gateway.create(dsName, remoteDsId);
}
return persistentDirectory.getName();
}
use of org.apache.geode.cache.wan.GatewaySenderFactory in project geode by apache.
the class WANTestBase method createSenderWithMultipleDispatchers.
public static void createSenderWithMultipleDispatchers(String dsName, int remoteDsId, boolean isParallel, Integer maxMemory, Integer batchSize, boolean isConflation, boolean isPersistent, GatewayEventFilter filter, boolean isManualStart, int numDispatchers, OrderPolicy orderPolicy) {
final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
try {
File persistentDirectory = new File(dsName + "_disk_" + System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
persistentDirectory.mkdir();
DiskStoreFactory dsf = cache.createDiskStoreFactory();
File[] dirs1 = new File[] { persistentDirectory };
GatewaySenderFactory gateway = configureGateway(dsf, dirs1, dsName, isParallel, maxMemory, batchSize, isConflation, isPersistent, filter, isManualStart, numDispatchers, orderPolicy);
gateway.create(dsName, remoteDsId);
} finally {
exln.remove();
}
}
Aggregations