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

Compare with Current View Page History

« Previous Version 12 Next »

  1. Download Protobuf for the target language of choice.
  2. Download the latest release of Geode.
  3. Start a Geode server with the following gfsh commands:

    Start Server
    gfsh>start locator --name=locator --bind-address=localhost --port=10334
    ...
    gfsh>start server --name=server --server-port=40404 --bind-address=localhost
    ...
    gfsh>create region --name=SampleData --type=REPLICATE
    Member | Status
    ------ | ----------------------------------------
    server | Region "/SampleData" created on "server"
  4. Locate Protobuf message definition artifact in the downloaded Geode release, e.g., $GEODE_HOME/tools/ClientProtocol/geode-protobuf-definitions-{versionNumber}.zip.
  5. Unzip Protobuf protocol message definitions. Using the relevant target language Protobuf library, generate the language bindings from the message definitions.

  6. Create your application that connects a TCP socket to the server running on the localhost, on port 40404.
  7. Write byte 110 to the socket.
  8. 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
    handshakeRequest {
      version {
        major: 1
        minor: 0
      }
      authenticationMode: NONE
    }
    handshakeResponse
    handshakeResponse {
      ok: 1
    }
  9. 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: "testRegion"
          entry {
            key {
              stringResult: "foo"
            }
            value {
              stringResult: "bar"
            }
         }
      }
    }
    putResponse
    message{ 
      putResponse {
    
    }
  10. Verify the put 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