Search in sources :

Example 11 with GatewaySenderFactory

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);
}
Also used : InternalGemFireException(org.apache.geode.InternalGemFireException) GatewaySenderFactory(org.apache.geode.cache.wan.GatewaySenderFactory)

Example 12 with GatewaySenderFactory

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));
}
Also used : GatewaySenderFactory(org.apache.geode.cache.wan.GatewaySenderFactory)

Example 13 with GatewaySenderFactory

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"));
    }
}
Also used : Declarable(org.apache.geode.cache.Declarable) CacheXmlException(org.apache.geode.cache.CacheXmlException) GatewaySenderFactory(org.apache.geode.cache.wan.GatewaySenderFactory) GatewayEventFilter(org.apache.geode.cache.wan.GatewayEventFilter)

Example 14 with GatewaySenderFactory

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);
}
Also used : GatewaySenderFactory(org.apache.geode.cache.wan.GatewaySenderFactory) File(java.io.File) DiskStoreFactory(org.apache.geode.cache.DiskStoreFactory)

Example 15 with GatewaySenderFactory

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);
}
Also used : GatewaySenderFactory(org.apache.geode.cache.wan.GatewaySenderFactory)

Aggregations

GatewaySenderFactory (org.apache.geode.cache.wan.GatewaySenderFactory)27 File (java.io.File)12 DiskStoreFactory (org.apache.geode.cache.DiskStoreFactory)12 DiskStore (org.apache.geode.cache.DiskStore)10 GatewayTransportFilter (org.apache.geode.cache.wan.GatewayTransportFilter)10 GatewaySender (org.apache.geode.cache.wan.GatewaySender)9 IgnoredException (org.apache.geode.test.dunit.IgnoredException)9 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)9 Test (org.junit.Test)9 GatewayEventFilter (org.apache.geode.cache.wan.GatewayEventFilter)8 AttributesFactory (org.apache.geode.cache.AttributesFactory)6 MyGatewayEventFilter1 (org.apache.geode.cache30.MyGatewayEventFilter1)6 MyGatewayTransportFilter1 (org.apache.geode.cache30.MyGatewayTransportFilter1)6 MyGatewayTransportFilter2 (org.apache.geode.cache30.MyGatewayTransportFilter2)6 Properties (java.util.Properties)5 Region (org.apache.geode.cache.Region)5 AbstractGatewaySender (org.apache.geode.internal.cache.wan.AbstractGatewaySender)5 ConfigurationProperties (org.apache.geode.distributed.ConfigurationProperties)4 InternalDistributedSystem (org.apache.geode.distributed.internal.InternalDistributedSystem)4 RegionQueue (org.apache.geode.internal.cache.RegionQueue)4