use of org.apache.geode.cache.wan.GatewaySenderFactory in project geode by apache.
the class CacheXmlParser method startGatewaySender.
private void startGatewaySender(Attributes atts) {
GatewaySenderFactory gatewaySenderFactory = this.cache.createGatewaySenderFactory();
String parallel = atts.getValue(PARALLEL);
if (parallel == null) {
gatewaySenderFactory.setParallel(GatewaySender.DEFAULT_IS_PARALLEL);
} else {
gatewaySenderFactory.setParallel(Boolean.parseBoolean(parallel));
}
// manual-start
String manualStart = atts.getValue(MANUAL_START);
if (manualStart == null) {
gatewaySenderFactory.setManualStart(GatewaySender.DEFAULT_MANUAL_START);
} else {
gatewaySenderFactory.setManualStart(Boolean.parseBoolean(manualStart));
}
// socket-buffer-size
String socketBufferSize = atts.getValue(SOCKET_BUFFER_SIZE);
if (socketBufferSize == null) {
gatewaySenderFactory.setSocketBufferSize(GatewaySender.DEFAULT_SOCKET_BUFFER_SIZE);
} else {
gatewaySenderFactory.setSocketBufferSize(Integer.parseInt(socketBufferSize));
}
// socket-read-timeout
String socketReadTimeout = atts.getValue(SOCKET_READ_TIMEOUT);
if (socketReadTimeout == null) {
gatewaySenderFactory.setSocketReadTimeout(GatewaySender.DEFAULT_SOCKET_READ_TIMEOUT);
} else {
gatewaySenderFactory.setSocketReadTimeout(Integer.parseInt(socketReadTimeout));
}
// batch-conflation
String batchConflation = atts.getValue(ENABLE_BATCH_CONFLATION);
if (batchConflation == null) {
gatewaySenderFactory.setBatchConflationEnabled(GatewaySender.DEFAULT_BATCH_CONFLATION);
} else {
gatewaySenderFactory.setBatchConflationEnabled(Boolean.parseBoolean(batchConflation));
}
// batch-size
String batchSize = atts.getValue(BATCH_SIZE);
if (batchSize == null) {
gatewaySenderFactory.setBatchSize(GatewaySender.DEFAULT_BATCH_SIZE);
} else {
gatewaySenderFactory.setBatchSize(Integer.parseInt(batchSize));
}
// batch-time-interval
String batchTimeInterval = atts.getValue(BATCH_TIME_INTERVAL);
if (batchTimeInterval == null) {
gatewaySenderFactory.setBatchTimeInterval(GatewaySender.DEFAULT_BATCH_TIME_INTERVAL);
} else {
gatewaySenderFactory.setBatchTimeInterval(Integer.parseInt(batchTimeInterval));
}
// enable-persistence
String enablePersistence = atts.getValue(ENABLE_PERSISTENCE);
if (enablePersistence == null) {
gatewaySenderFactory.setPersistenceEnabled(GatewaySender.DEFAULT_PERSISTENCE_ENABLED);
} else {
gatewaySenderFactory.setPersistenceEnabled(Boolean.parseBoolean(enablePersistence));
}
String diskStoreName = atts.getValue(DISK_STORE_NAME);
if (diskStoreName == null) {
gatewaySenderFactory.setDiskStoreName(null);
} else {
gatewaySenderFactory.setDiskStoreName(diskStoreName);
}
String diskSynchronous = atts.getValue(DISK_SYNCHRONOUS);
if (diskSynchronous == null) {
gatewaySenderFactory.setDiskSynchronous(GatewaySender.DEFAULT_DISK_SYNCHRONOUS);
} else {
gatewaySenderFactory.setDiskSynchronous(Boolean.parseBoolean(diskSynchronous));
}
// maximum-queue-memory
String maxQueueMemory = atts.getValue(MAXIMUM_QUEUE_MEMORY);
if (maxQueueMemory == null) {
gatewaySenderFactory.setMaximumQueueMemory(GatewaySender.DEFAULT_MAXIMUM_QUEUE_MEMORY);
} else {
gatewaySenderFactory.setMaximumQueueMemory(Integer.parseInt(maxQueueMemory));
}
String alertThreshold = atts.getValue(ALERT_THRESHOLD);
if (alertThreshold == null) {
gatewaySenderFactory.setAlertThreshold(GatewaySender.DEFAULT_ALERT_THRESHOLD);
} else {
gatewaySenderFactory.setAlertThreshold(Integer.parseInt(alertThreshold));
}
String dispatcherThreads = atts.getValue(DISPATCHER_THREADS);
if (dispatcherThreads == null) {
gatewaySenderFactory.setDispatcherThreads(GatewaySender.DEFAULT_DISPATCHER_THREADS);
} else {
gatewaySenderFactory.setDispatcherThreads(Integer.parseInt(dispatcherThreads));
}
String id = atts.getValue(ID);
String orderPolicy = atts.getValue(ORDER_POLICY);
if (orderPolicy != null) {
try {
gatewaySenderFactory.setOrderPolicy(GatewaySender.OrderPolicy.valueOf(orderPolicy.toUpperCase()));
} catch (IllegalArgumentException e) {
throw new InternalGemFireException(LocalizedStrings.SerialGatewaySender_UNKNOWN_GATEWAY_ORDER_POLICY_0_1.toLocalizedString(new Object[] { id, orderPolicy }));
}
}
String remoteDS = atts.getValue(REMOTE_DISTRIBUTED_SYSTEM_ID);
stack.push(id);
stack.push(remoteDS);
stack.push(gatewaySenderFactory);
// GatewaySender sender = gatewaySenderFactory.create(id, Integer.parseInt(remoteDS));
// stack.push(sender);
}
use of org.apache.geode.cache.wan.GatewaySenderFactory in project geode by apache.
the class CacheXmlParser method endSerialGatewaySender.
private void endSerialGatewaySender() {
GatewaySenderFactory senderFactory = (GatewaySenderFactory) stack.pop();
String remoteDSString = (String) stack.pop();
String id = (String) stack.pop();
senderFactory.create(id, Integer.parseInt(remoteDSString));
}
use of org.apache.geode.cache.wan.GatewaySenderFactory in project geode by apache.
the class CacheXmlParser method endGatewayEventFilter.
private void endGatewayEventFilter() {
Declarable d = createDeclarable();
if (!(d instanceof GatewayEventFilter)) {
throw new CacheXmlException(LocalizedStrings.CacheXmlParser_A_0_IS_NOT_AN_INSTANCE_OF_A_1.toLocalizedString(new Object[] { d.getClass().getName(), "GatewayEventFilter" }));
}
Object obj = stack.peek();
if (obj instanceof GatewaySenderFactory) {
GatewaySenderFactory senderFactory = (GatewaySenderFactory) obj;
senderFactory.addGatewayEventFilter((GatewayEventFilter) d);
} else if (obj instanceof AsyncEventQueueCreation) {
AsyncEventQueueCreation asyncEventQueueCreation = (AsyncEventQueueCreation) obj;
asyncEventQueueCreation.addGatewayEventFilter((GatewayEventFilter) d);
} else {
throw new CacheXmlException(LocalizedStrings.CacheXmlParser_A_0_MUST_BE_DEFINED_IN_THE_CONTEXT_OF_GATEWAY_SENDER_OR_ASYNC_EVENT_QUEUE.toLocalizedString("GatewayEventFilter"));
}
}
use of org.apache.geode.cache.wan.GatewaySenderFactory in project geode by apache.
the class WANTestBase method createConcurrentSender.
public static void createConcurrentSender(String dsName, int remoteDsId, boolean isParallel, Integer maxMemory, Integer batchSize, boolean isConflation, boolean isPersistent, GatewayEventFilter filter, boolean isManualStart, int concurrencyLevel, OrderPolicy policy) {
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, concurrencyLevel, policy);
gateway.create(dsName, remoteDsId);
}
use of org.apache.geode.cache.wan.GatewaySenderFactory in project geode by apache.
the class WANTestBase method createSenderWithoutDiskStore.
public static void createSenderWithoutDiskStore(String dsName, int remoteDsId, Integer maxMemory, Integer batchSize, boolean isConflation, boolean isManualStart) {
GatewaySenderFactory gateway = cache.createGatewaySenderFactory();
gateway.setParallel(true);
gateway.setMaximumQueueMemory(maxMemory);
gateway.setBatchSize(batchSize);
gateway.setManualStart(isManualStart);
// set dispatcher threads
gateway.setDispatcherThreads(numDispatcherThreadsForTheRun);
gateway.setBatchConflationEnabled(isConflation);
gateway.create(dsName, remoteDsId);
}
Aggregations