Create a Gateway Receiver

To accept DML replication requests from remote GemFire XD clusters, a GemFire XD cluster requires a gateway receiver, which specifies the members that can receive connections from one or more remote gateway senders.

A GemFire XD cluster needs only a single gateway receiver, regardless of how many remote sites replicate data to the cluster. However, you can deploy multiple instances of a gateway receiver to different GemFire XD members for high availability.

Procedure

Note: The GemFire XD cluster that replicates DML operations from another cluster must have the same table definitions available to apply the DML operations. The tables that are used in WAN replication do not have to reside on the same GemFire XD members that host the gateway receiver.
  1. Use the CREATE GATEWAYRECEIVER statement and specify the server group to which you want to deploy the receiver. If the GemFire XD members that host the receiver configured a remote WAN address at startup (using the -custom-value option at startup), specify the name of the value in the CREATE GATEWAYSENDER command's HOSTNAMEFORSENDERS option.

    Also specify a range of port numbers to use for the receivers. GemFire XD selects an unused port number from the range you specify when starting the receiver. If no port number in the range is available, an exception is thrown.

    For example:
    gfxd> CREATE GATEWAYRECEIVER test_receiver 
    > (hostnameforsenders 'NIC1' startport 1530 endport 1541) server groups (receivergroup1);
    This creates a receiver on data stores in "receivergroup1" using an available port number from 1530 to 1540. Each receiver uses the remote WAN address that was specified in the server startup command option for -custom-NIC1 (see Start Datastores for WAN Replication for more information). If you do not specify the HOSTNAMEFORSENDERS argument, then the local address of each member that hosts the receiver must be reachable from across the WAN.
  2. Query the GATEWAYRECEIVERS to determine which port number was selected to listen for WAN connections:
    select id, running_port, server_groups, host_name_for_senders from sys.gatewayreceivers;
    ID             |RUNNING_PORT      |SERVER_GROUPS    |HOST_NAME_FOR_SENDERS
    --------------------------------------------------------------------------
    TEST_RECEIVER  |1537              |RECEIVERGROUP1   |ordersreceiver1
    TEST_RECEIVER  |1537              |RECEIVERGROUP1   |ordersreceiver2
    2 rows selected

    In this example, the gateway receiver listens on port 1537.

CREATE GATEWAYRECEIVER provides additional information about creating receivers.