use of org.apache.geode.cache.wan.GatewayTransportFilter in project geode by apache.
the class CacheXmlGenerator method generateGatewaySender.
private void generateGatewaySender(GatewaySender sender) throws SAXException {
AttributesImpl atts = new AttributesImpl();
// id
atts.addAttribute("", "", ID, "", sender.getId());
// remote-distributed-system
atts.addAttribute("", "", REMOTE_DISTRIBUTED_SYSTEM_ID, "", String.valueOf(sender.getRemoteDSId()));
// parallel
if (generateDefaults() || sender.isParallel() != GatewaySender.DEFAULT_IS_PARALLEL)
atts.addAttribute("", "", PARALLEL, "", String.valueOf(sender.isParallel()));
// manual-start
if (generateDefaults() || sender.isManualStart() != GatewaySender.DEFAULT_MANUAL_START)
atts.addAttribute("", "", MANUAL_START, "", String.valueOf(sender.isManualStart()));
// socket-buffer-size
if (generateDefaults() || sender.getSocketBufferSize() != GatewaySender.DEFAULT_SOCKET_BUFFER_SIZE)
atts.addAttribute("", "", SOCKET_BUFFER_SIZE, "", String.valueOf(sender.getSocketBufferSize()));
// socket-read-timeout
if (generateDefaults() || sender.getSocketReadTimeout() != GatewaySender.DEFAULT_SOCKET_READ_TIMEOUT)
atts.addAttribute("", "", SOCKET_READ_TIMEOUT, "", String.valueOf(sender.getSocketReadTimeout()));
// enable-batch-conflation
if (generateDefaults() || sender.isBatchConflationEnabled() != GatewaySender.DEFAULT_BATCH_CONFLATION)
atts.addAttribute("", "", ENABLE_BATCH_CONFLATION, "", // Should we use ENABLE-CONFLATION
String.valueOf(sender.isBatchConflationEnabled()));
// batch-size
if (generateDefaults() || sender.getBatchSize() != GatewaySender.DEFAULT_BATCH_SIZE)
atts.addAttribute("", "", BATCH_SIZE, "", String.valueOf(sender.getBatchSize()));
// batch-time-interval
if (generateDefaults() || sender.getBatchTimeInterval() != GatewaySender.DEFAULT_BATCH_TIME_INTERVAL)
atts.addAttribute("", "", BATCH_TIME_INTERVAL, "", String.valueOf(sender.getBatchTimeInterval()));
// enable-persistence
if (generateDefaults() || sender.isPersistenceEnabled() != GatewaySender.DEFAULT_PERSISTENCE_ENABLED)
atts.addAttribute("", "", ENABLE_PERSISTENCE, "", String.valueOf(sender.isPersistenceEnabled()));
// disk-store-name
if (generateDefaults() || sender.getDiskStoreName() != null && !sender.getDiskStoreName().equals(""))
atts.addAttribute("", "", DISK_STORE_NAME, "", String.valueOf(sender.getDiskStoreName()));
// disk-synchronous
if (generateDefaults() || sender.isDiskSynchronous() != GatewaySender.DEFAULT_DISK_SYNCHRONOUS)
atts.addAttribute("", "", DISK_SYNCHRONOUS, "", String.valueOf(sender.isDiskSynchronous()));
// maximum-queue-memory
if (generateDefaults() || sender.getMaximumQueueMemory() != GatewaySender.DEFAULT_MAXIMUM_QUEUE_MEMORY)
atts.addAttribute("", "", MAXIMUM_QUEUE_MEMORY, "", String.valueOf(sender.getMaximumQueueMemory()));
// alert-threshold
if (generateDefaults() || sender.getAlertThreshold() != GatewaySender.DEFAULT_ALERT_THRESHOLD)
atts.addAttribute("", "", ALERT_THRESHOLD, "", String.valueOf(sender.getAlertThreshold()));
// dispatcher-threads
if (generateDefaults() || sender.getDispatcherThreads() != GatewaySender.DEFAULT_DISPATCHER_THREADS)
atts.addAttribute("", "", DISPATCHER_THREADS, "", String.valueOf(sender.getDispatcherThreads()));
// order-policy
if (sender.getOrderPolicy() != null) {
if (generateDefaults() || !sender.getOrderPolicy().equals(GatewaySender.DEFAULT_ORDER_POLICY))
atts.addAttribute("", "", ORDER_POLICY, "", String.valueOf(sender.getOrderPolicy()));
}
handler.startElement("", GATEWAY_SENDER, GATEWAY_SENDER, atts);
for (GatewayEventFilter gef : sender.getGatewayEventFilters()) {
generateGatewayEventFilter(gef);
}
if (this.version.compareTo(CacheXmlVersion.GEMFIRE_8_0) >= 0) {
if (sender.getGatewayEventSubstitutionFilter() != null) {
generateGatewayEventSubstitutionFilter(sender.getGatewayEventSubstitutionFilter());
}
}
for (GatewayTransportFilter gsf : sender.getGatewayTransportFilters()) {
generateGatewayTransportFilter(gsf);
}
handler.endElement("", GATEWAY_SENDER, GATEWAY_SENDER);
}
use of org.apache.geode.cache.wan.GatewayTransportFilter in project geode by apache.
the class SerialGatewaySenderImpl method fillInProfile.
@Override
public void fillInProfile(Profile profile) {
assert profile instanceof GatewaySenderProfile;
GatewaySenderProfile pf = (GatewaySenderProfile) profile;
pf.Id = getId();
pf.startTime = getStartTime();
pf.remoteDSId = getRemoteDSId();
pf.isRunning = isRunning();
pf.isPrimary = isPrimary();
pf.isParallel = false;
pf.isBatchConflationEnabled = isBatchConflationEnabled();
pf.isPersistenceEnabled = isPersistenceEnabled();
pf.alertThreshold = getAlertThreshold();
pf.manualStart = isManualStart();
for (org.apache.geode.cache.wan.GatewayEventFilter filter : getGatewayEventFilters()) {
pf.eventFiltersClassNames.add(filter.getClass().getName());
}
for (GatewayTransportFilter filter : getGatewayTransportFilters()) {
pf.transFiltersClassNames.add(filter.getClass().getName());
}
for (AsyncEventListener listener : getAsyncEventListeners()) {
pf.senderEventListenerClassNames.add(listener.getClass().getName());
}
pf.isDiskSynchronous = isDiskSynchronous();
pf.dispatcherThreads = getDispatcherThreads();
pf.orderPolicy = getOrderPolicy();
pf.serverLocation = this.getServerLocation();
}
use of org.apache.geode.cache.wan.GatewayTransportFilter in project geode by apache.
the class CacheXml80GatewayDUnitTest method testGatewayReceiverWithManualStartTRUE.
@Test
public void testGatewayReceiverWithManualStartTRUE() throws Exception {
// getSystem();
CacheCreation cache = new CacheCreation();
GatewayReceiverFactory gatewayReceiverFactory = cache.createGatewayReceiverFactory();
gatewayReceiverFactory.setBindAddress("");
gatewayReceiverFactory.setStartPort(20000);
gatewayReceiverFactory.setEndPort(29999);
gatewayReceiverFactory.setMaximumTimeBetweenPings(2000);
gatewayReceiverFactory.setSocketBufferSize(1500);
gatewayReceiverFactory.setManualStart(true);
GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
gatewayReceiverFactory.addGatewayTransportFilter(myStreamFilter1);
GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
gatewayReceiverFactory.addGatewayTransportFilter(myStreamFilter2);
GatewayReceiver receiver1 = gatewayReceiverFactory.create();
receiver1.start();
testXml(cache);
Cache c = getCache();
assertNotNull(c);
Set<GatewayReceiver> receivers = c.getGatewayReceivers();
for (GatewayReceiver receiver : receivers) {
validateGatewayReceiver(receiver1, receiver);
}
}
use of org.apache.geode.cache.wan.GatewayTransportFilter in project geode by apache.
the class ParallelGatewaySenderImpl method fillInProfile.
public void fillInProfile(Profile profile) {
assert profile instanceof GatewaySenderProfile;
GatewaySenderProfile pf = (GatewaySenderProfile) profile;
pf.Id = getId();
pf.remoteDSId = getRemoteDSId();
pf.isRunning = isRunning();
pf.isPrimary = isPrimary();
pf.isParallel = true;
pf.isBatchConflationEnabled = isBatchConflationEnabled();
pf.isPersistenceEnabled = isPersistenceEnabled();
pf.alertThreshold = getAlertThreshold();
pf.manualStart = isManualStart();
pf.dispatcherThreads = getDispatcherThreads();
pf.orderPolicy = getOrderPolicy();
for (GatewayEventFilter filter : getGatewayEventFilters()) {
pf.eventFiltersClassNames.add(filter.getClass().getName());
}
for (GatewayTransportFilter filter : getGatewayTransportFilters()) {
pf.transFiltersClassNames.add(filter.getClass().getName());
}
for (AsyncEventListener listener : getAsyncEventListeners()) {
pf.senderEventListenerClassNames.add(listener.getClass().getName());
}
pf.isDiskSynchronous = isDiskSynchronous();
}
use of org.apache.geode.cache.wan.GatewayTransportFilter in project geode by apache.
the class WANTestBase method createSenderForValidations.
public static void createSenderForValidations(String dsName, int remoteDsId, boolean isParallel, Integer alertThreshold, boolean isConflation, boolean isPersistent, List<GatewayEventFilter> eventFilters, List<GatewayTransportFilter> transportFilters, boolean isManualStart, boolean isDiskSync) {
IgnoredException exp1 = IgnoredException.addIgnoredException(RegionDestroyedException.class.getName());
try {
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.setAlertThreshold(alertThreshold);
((InternalGatewaySenderFactory) gateway).setLocatorDiscoveryCallback(new MyLocatorCallback());
if (eventFilters != null) {
for (GatewayEventFilter filter : eventFilters) {
gateway.addGatewayEventFilter(filter);
}
}
if (transportFilters != null) {
for (GatewayTransportFilter filter : transportFilters) {
gateway.addGatewayTransportFilter(filter);
}
}
if (isPersistent) {
gateway.setPersistenceEnabled(true);
gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName + "_Parallel").getName());
} else {
DiskStore store = dsf.setDiskDirs(dirs1).create(dsName + "_Parallel");
gateway.setDiskStoreName(store.getName());
}
gateway.setDiskSynchronous(isDiskSync);
gateway.setBatchConflationEnabled(isConflation);
gateway.setManualStart(isManualStart);
// set dispatcher threads
gateway.setDispatcherThreads(numDispatcherThreadsForTheRun);
gateway.create(dsName, remoteDsId);
} else {
GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
gateway.setAlertThreshold(alertThreshold);
gateway.setManualStart(isManualStart);
// set dispatcher threads
gateway.setDispatcherThreads(numDispatcherThreadsForTheRun);
((InternalGatewaySenderFactory) gateway).setLocatorDiscoveryCallback(new MyLocatorCallback());
if (eventFilters != null) {
for (GatewayEventFilter filter : eventFilters) {
gateway.addGatewayEventFilter(filter);
}
}
if (transportFilters != null) {
for (GatewayTransportFilter filter : transportFilters) {
gateway.addGatewayTransportFilter(filter);
}
}
gateway.setBatchConflationEnabled(isConflation);
if (isPersistent) {
gateway.setPersistenceEnabled(true);
gateway.setDiskStoreName(dsf.setDiskDirs(dirs1).create(dsName + "_Serial").getName());
} else {
DiskStore store = dsf.setDiskDirs(dirs1).create(dsName + "_Serial");
gateway.setDiskStoreName(store.getName());
}
gateway.setDiskSynchronous(isDiskSync);
gateway.create(dsName, remoteDsId);
}
} finally {
exp1.remove();
}
}
Aggregations