All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gemstone.gemfire.cache.wan.GatewaySenderFactory Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you
 * may not use this file except in compliance with the License. You
 * may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * permissions and limitations under the License. See accompanying
 * LICENSE file.
 */

package com.gemstone.gemfire.cache.wan;

import com.gemstone.gemfire.cache.util.Gateway.OrderPolicy;

/**
 * Factory to create SerialGatewaySender
 * 
 * @author Suranjan Kumar
 * @author Yogesh Mahajan
 * @author Kishor Bachhav
 * 
 * @since 7.0
 * @see GatewaySender
 * 
 */
public interface GatewaySenderFactory {

  /**
   * Indicates whether all VMs need to distribute events to remote site.
   * In this case only the events originating in a particular VM will be in dispatched in order.
   *
   * @param isParallel
   *          boolean to indicate whether distribution policy is parallel
   */
  public GatewaySenderFactory setParallel(boolean isParallel);
  
  /**
   * Adds a GatewayEventFilter
   * 
   * @param filter
   *          GatewayEventFilter
   */
  public GatewaySenderFactory addGatewayEventFilter(
      GatewayEventFilter filter);

  /**
   * Adds a GatewayTransportFilter
   * 
   * @param filter
   *          GatewayTransportFilter
   */
  public GatewaySenderFactory addGatewayTransportFilter(
      GatewayTransportFilter filter);

  /**
   * Sets the buffer size in bytes of the socket connection for this
   * GatewaySender. The default is 32768 bytes.
   * 
   * @param size
   *          The size in bytes of the socket buffer
   */
  public GatewaySenderFactory setSocketBufferSize(int size);

  /**
   * Sets the number of milliseconds to wait for a response from a
   * GatewayReceiver before timing out the operation and trying
   * another GatewayReceiver (if any are available).
   * 
   * @param timeout
   *          number of milliseconds to wait for a response from a
   *          GatewayReceiver
   * @throws IllegalArgumentException
   *           if timeout is less than or equal to 0.
   */
  public GatewaySenderFactory setSocketReadTimeout(int timeout);

  /**
   * Sets the disk store name for overflow or persistence
   * 
   * @param name
   */
  public GatewaySenderFactory setDiskStoreName(String name);

  /**
   * Sets the number of dispatcher thread
   * 
   * @param numThreads
   */
  public GatewaySenderFactory setDispatcherThreads(int numThreads);

  /**
   * Sets OrderPolicy for this GatewaySender
   * 
   * @param policy
   */
  public GatewaySenderFactory setOrderPolicy(OrderPolicy policy);
  
  /**
   * Sets the maximum amount of memory (in MB) for a
   * GatewaySender's queue.
   * 
   * @param maxQueueMemory
   *           The maximum amount of memory (in MB) for a
   *          GatewaySender's queue.
   */
  public GatewaySenderFactory setMaximumQueueMemory(int maxQueueMemory);

  /**
   * Sets the batch size to be picked at the time of dispatching from a GatewaySender's queue.
   * 
   * @param size
   *          The size of batches sent from a GatewaySender to its
   *          corresponding GatewayReceiver.
   */
  public GatewaySenderFactory setBatchSize(int size);

  /**
   * Sets a time interval in milliseconds to wait to form a batch to be dispatched from a GatewaySender's
   * queue
   * 
   * @param interval
   *          The maximum time interval (in milliseconds) that can elapse before a partial batch
   *          is sent from a GatewaySender to its corresponding
   *          GatewayReceiver.
   */
  public GatewaySenderFactory setBatchTimeInterval(int interval);

  /**
   * Sets whether to enable batch conflation for a
   * GatewaySender's queue.
   * 
   * @param isConflation
   *          Whether or not to enable batch conflation for batches sent from a
   *          GatewaySender to its corresponding
   *          GatewayReceiver.
   */
  public GatewaySenderFactory setBatchConflationEnabled(
      boolean isConflation);

  /**
   * Sets whether to enable persistence for a GatewaySender's
   * queue.
   * 
   * @param isPersistence
   *          Whether to enable persistence for a
   *          GatewaySender's queue
   */
  public GatewaySenderFactory setPersistenceEnabled(boolean isPersistence);

  /**
   * Sets the alert threshold for entries in a GatewaySender
   * 's queue.
   * 
   * @param threshold
   *          the alert threshold for entries in a
   *          GatewaySender's queue
   */
  public GatewaySenderFactory setAlertThreshold(int threshold);

  /**
   * Sets the manual start boolean property for this
   * GatewaySender.
   * 
   * @param start
   *          the manual start boolean property for this
   *          GatewaySender
   */
  public GatewaySenderFactory setManualStart(boolean start);
  
  /**
   * Sets whether or not the writing to the disk is synchronous.
   * 
   * @param isSynchronous
   *          boolean if true indicates synchronous writes
   *  
   */
  public GatewaySenderFactory setDiskSynchronous(boolean isSynchronous);
  
  /**
   * Removes the provided GatewayEventFilter from this
   * GatewaySender.
   * 
   * @param filter
   */
  public GatewaySenderFactory removeGatewayEventFilter(GatewayEventFilter filter);

  /**
   * Removes the provided GatewayTransportFilter from this
   * GatewaySender.
   * 
   * @param filter
   */
  public GatewaySenderFactory removeGatewayTransportFilter(GatewayTransportFilter filter);

  public GatewaySenderFactory setParallelFactorForReplicatedRegion(int parallel);
  
  /**
   * Creates a GatewaySender to communicate with remote
   * distributed system
   * 
   * @param id
   *          unique id for this SerialGatewaySender
   * @param remoteDSId
   *          unique id representing the remote distributed system
   * @return instance of SerialGatewaySender
   * @throws IllegalStateException 
   *           If the GatewaySender creation fails during validation due to mismatch of 
   *           attributes of GatewaySender created on other nodes with same id 
   */
  public GatewaySender create(String id, int remoteDSId);


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy