Connecting to the GPSS Server

A newer version of this documentation is available. Click here to view the most up-to-date release of the Greenplum 5.x documentation.

Connecting to the GPSS Server

Before a GPSS client can load data into Greenplum Database, the client must first establish a connection to the Greenplum Stream Server.

When you start a GPSS server instance, you provide a JSON-format configuration file. You identify the hostname and port on which the GPSS server instance listens for connection requests in this configuration file. For more information about the GPSS server, refer to the gpss reference page.

The GPSS client application must create a gRPC managed channel to this GPSS instance. Because GPSS supports the simple RPC service, the client creates a blocking stub on the channel.

This sample Java client code connects to and disconnects from a GPSS service instance listening for connections on port number 50007 on the local host:

java.util.concurrent.TimeUnit;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;

String gpssHost = "localhost";
Integer gpssPort = 50007;
ManagedChannel channel = null;
GpssGrpc.GpssBlockingStub bStub = null;

try {
  // connect to GPSS gRPC service instance; create a channel and a blocking stub
  channel = ManagedChannelBuilder.forAddress(gpssHost, gpssPort)
    .usePlaintext(true)
    .build();
  bStub = GpssGrpc.newBlockingStub(channel);

  // (placeholder) do stuff here

  // shutdown the channel
  channel.shutdown().awaitTermination(7, TimeUnit.SECONDS);

} catch (Exception e) {
  ...
}

After the GPSS client instantiates a stub, the client can use the stub to invoke the GPSS service methods.