CREATE GATEWAYRECEIVER

Creates a gateway receiver to replicate data from a remote GemFire XD cluster.

Syntax

CREATE GATEWAYRECEIVER receiver-name
(
  [ HOSTNAMEFORSENDERS 'value' ]
  [ BINDADDRESS 'address' ]
  [ STARTPORT integer-constant ]
  [ ENDPORT integer-constant ]
  [ SOCKETBUFFERSIZE integer-constant ]
  [ MAXTIMEBETWEENPINGS integer_constant ]
) [ SERVER GROUPS ( server_group_name [, server_group_name ]*)]
receiver-name
A unique identifier for this receiver. You can use this identifier with the DROP GATEWAYRECEIVER statement to remove the receiver configuration if necessary.
HOSTNAMEFORSENDERS
The network address that gateway senders should use to connect to the receiver over the WAN. This option may be necessary if the local addresses of GemFire XD members cannot be used to access those members over the WAN. To use this option, you must start each GemFire XD member that will host a gateway receiver using the -custom-value=address property, specifying the unique WAN address for each member. You then specify the value portion of the property with HOSTNAMEFORSENDERS. See the examples below for more information.
BINDADDRESS
The local network address to use for connections from gateway senders in other sites. Specify the address as a literal string value.
STARTPORT
The starting port number to use when specifying the range of possible port numbers this gateway receiver will use to for connections from gateway senders in other sites. GemFire XD chooses an unused port number in the specified port number range to start the receiver. If no port numbers in the range are available, an exception is thrown.
The STARTPORT value is inclusive while the ENDPORT value is exclusive. For example, if you specify STARTPORT=50510 and ENDPOINT=50520, GemFire XD chooses a port value from 50510 to 50519.
If you do not specify STARTPORT, the default value is 5000.
ENDPORT
Defines the upper bound port number to use when specifying the range of possible port numbers this gateway receiver will use to for connections from gateway senders in other sites. GemFire XD chooses an unused port number in the specified port number range to start the receiver. If no port numbers in the range are available, an exception is thrown.
The ENDPORT value is exclusive while the STARTPORT value is inclusive. For example, if you specify STARTPORT=50510 and ENDPOINT=50520, GemFire XD chooses a port value from 50510 to 50519.
If you do not specify STARTPORT, the default value is 5500.
SOCKETBUFFERSIZE
An integer value that sets the buffer size in bytes of the socket connection for this gateway receiver. If you supply a null value, GemFire XD uses the default of 32768 bytes.
MAXTIMEBETWEENPINGS
An integer value that specifies the time interval to use between pings to connected WAN sites. This value determines the maximum amount of time that can elapse before a remote WAN site is considered offline. The default value is 60000 milliseconds.
SERVER GROUPS
A comma-separated list of server groups on which to deploy the gateway receiver.
Note: The server group names that you specify are converted to all-uppercase characters, even if you specify the names as quoted identifiers.

Example

Create a gateway receiver on any available port between 1530 and 1540, on data stores that are members of "testreceivers":
create gatewayreceiver testreceiver (startport 1530 endport 1541) server groups (testreceivers);
0 rows inserted/updated/deleted
Create a second gateway receiver in the server group "productionreceivers":
create productionreceiver (startport 1540 endport 1551) server groups (productionreceivers);
0 rows inserted/updated/deleted
Query the GATEWAYRECEIVERS to determine the port number that GemFire XD selected:
gfxd> select id, running_port, server_groups from sys.gatewayreceivers;
ID                  |RUNNING_PORT      |SERVER_GROUPS                    
------------------------------------------------------------
TESTRECEIVER        |1538              |TESTRECEIVERS    
PRODUCTIONRECEIVER  |1544              |PRODUCTIONRECEIVERS

2 rows selected
Note that the above examples assume that the local addresses of the gateway receiver members are accessible to remote gateway senders over the WAN. If you must supply a different address to access the receivers over the WAN, you would first need to start each gateway receiver member with the -custom-value=address property to specify the WAN-accessible address:
gfxd server start
     -dir=/opt/gfxd/recserver1
     -locators=ds2host:10101
     -server-groups=receivergroup1
     -custom-NIC1=ordersreceiver1
gfxd server start
     -dir=/opt/gfxd/recserver2
     -locators=ds2host:10101
     -server-groups=receivergroup1
     -custom-NIC1=ordersreceiver2
You would then specify the name of the custom parameter when creating the gateway receiver for this configuration:
gfxd> CREATE GATEWAYRECEIVER test_receiver 
> (hostnameforsenders 'NIC1' startport 1530 endport 1541) server groups (receivergroup1);
By creating the receiver configuration in this way, each GemFire XD member uses its unique WAN address to provide connectivity for remote senders:
select id, running_port, server_groups, host_name_for_senders from sys.gatewayreceivers;
ID             |RUNNING_PORT      |SERVER_GROUPS    |HOST_NAME_FOR_SENDERS
--------------------------------------------------------------------------
TEST_RECEIVER  |1538              |RECEIVERGROUP1   |ordersreceiver1
TEST_RECEIVER  |1540              |RECEIVERGROUP1   |ordersreceiver2
2 rows selected