You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 19 Next »

  1. Download Protobuf for the target language of choice, build it, and install it.
  2. Download the latest pre-built release of Geode and install it.
  3. Start a Geode locator, start a Geode server, and create a region with the following gfsh commands:

    Start Server
    gfsh>start locator --name=locator --bind-address=localhost --port=10334
    ...
    gfsh>start server --name=server --bind-address=localhost --server-port=40404
    ...
    gfsh>create region --name=SampleData --type=REPLICATE
    Member | Status
    ------ | ----------------------------------------
    server | Region "/SampleData" created on "server"
  4. Extract the Protobuf message definition artifacts from the Geode release: $GEODE_HOME/tools/ClientProtocol/v1/geode-protobuf-definitions-<version-number>.zip.
  5. Generate the language bindings from the message definitions using the relevant target language Protobuf library using the appropriate Protobuf utility such as protoc.

  6. Create your application that connects a TCP socket to the server running on the host localhost on port 40404.
  7. Set up communication with the server. Within your application, write byte 0x6E (decimal 110) to the socket to select Protobuf communication. Then write byte 0x01 (decimal 1) to the socket to indicate the major version number of the Protobuf message definitions that are to be used.
  8. Within your application, build a handshake request message, write it in a delimited fashion to the socket, and read the handshake response message in a delimited fashion from it.

    handshakeRequest
    message {
        handshakeRequest {
            majorVersion: 1
    	    minorVersion: 1
    	}
    }
    handshakeResponse
    message {
        handshakeResponse {
            serverMajorVersion: 1
            serverMinorVersion: 1
            handshakePassed: true
        }
    }
  9. To exercise the protocol to interact with the server, within your application build a put request message to put the value bar for the key foo, write it in a delimited fashion to the socket, and read the put response message in a delimited fashion from it.

    putRequest
    message{ 
      putRequest {
        regionName: "SampleData"
          entry {
            key {
              stringResult: "foo"
            }
            value {
              stringResult: "bar"
            }
         }
      }
    }
    putResponse
    message{ 
      putResponse {
      }
    }
  10. Outside your application, verify that the put request message took effect with the following gfsh command:

    Verify Put
    gfsh>get --region=SampleData --key=foo
    Result      : true
    Key Class   : java.lang.String
    Key         : foo
    Value Class : java.lang.String
    Value       : bar

 

  • No labels