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

com.gemstone.gemfire.cache.wan.GatewayReceiver 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 java.io.IOException;
import java.util.List;

/**
 * A GatewayReceiver that receives the events from a GatewaySender.
 * GatewayReceiver is used in conjunction with a {@link GatewaySender} to
 * connect two distributed-systems. This GatewayReceiver will receive all the
 * events originating in distributed-systems that has a
 * GatewaySender connected to this distributed-system.
 * 
 * @author Suranjan Kumar
 * 
 */
public interface GatewayReceiver {

  /**
   * The default maximum amount of time between client pings. This value
   * is used by the ClientHealthMonitor to determine the
   * health of this GatewayReceiver's clients.
   */
  public static final  int DEFAULT_MAXIMUM_TIME_BETWEEN_PINGS  = 60000;

  /**
   * Default start value of the port range from which the GatewayReceiver's port will be chosen
   */
  public static final int DEFAULT_START_PORT = 5000;
  
  /**
   * Default end value of the port range from which the GatewayReceiver's port will be chosen
   */
  public static final int DEFAULT_END_PORT = 5500;
  
  /**
   * The default buffer size for socket buffers for the GatewayReceiver.
   */
  public static final int DEFAULT_SOCKET_BUFFER_SIZE = 524288;
  
  /**
   * The default ip address or host name that the receiver's socket will
   * listen on for client connections.
   * The current default is an empty string.
   */
  public static final String DEFAULT_BIND_ADDRESS = ""; 
  
  public static final String DEFAULT_HOSTNAME_FOR_SENDERS = "";
  
  /**
   * If the batch already seen by this receiver, arrives again then whether it is to be
   * re-applied or not is decided by this attribute.  
   */
  public static final boolean APPLY_RETRIES = Boolean
      .getBoolean("gemfire.GatewayReceiver.ApplyRetries");

  public String getId();

  /**
   * Starts this receiver.  Once the receiver is running, its
   * configuration cannot be changed.
   *
   * @throws IOException
   *         If an error occurs while starting the receiver
   */
  public void start() throws IOException;

  /**
   * Stops this receiver. Note that the
   * GatewayReceiver can be reconfigured and restarted if
   * desired.
   */
  public void stop();

  /**
   * Returns whether or not this receiver is running
   */
  public boolean isRunning();

  /**
   * Returns the list of GatewayTransportFilter added to this
   * GatewayReceiver.
   * 
   * @return the list of GatewayTransportFilter added to this
   *         GatewayReceiver.
   */
  public List getGatewayTransportFilters();

  /**
   * Returns the maximum amount of time between client pings. This value is
   * used by the ClientHealthMonitor to determine the health
   * of this GatewayReceiver's clients (i.e. the GatewaySenders). 
   * The default is 60000 ms.
   * @return the maximum amount of time between client pings.
   */
  public int getMaximumTimeBetweenPings();

  /**
   * Returns the port on which this GatewayReceiver listens for clients.
   */
  public int getPort();

  /**
   * Returns start value of the port range from which the GatewayReceiver's port will be chosen.
   */
  public int getStartPort();

  /**
   * Returns end value of the port range from which the GatewayReceiver's port will be chosen.
   */
  public int getEndPort();

  /**
   * Returns a string representing the ip address or host name that server locators
   * will tell clients (GatewaySenders in this case) that this receiver is listening on.
   * @return the ip address or host name to give to clients so they can connect
   *         to this receiver
   */
  public String getHost();

  /**
   * Returns the configured buffer size of the socket connection for this
   * GatewayReceiver. The default is 524288 bytes.
   * @return the configured buffer size of the socket connection for this
   * GatewayReceiver
   */
  public int getSocketBufferSize();

  /**
   * Returns a string representing the ip address or host name that this server
   * will listen on.
   * @return the ip address or host name that this server is to listen on
   * @see #DEFAULT_BIND_ADDRESS
   */
  public String getBindAddress();
}