Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Better wordsmithing from Karen
  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:

    Code Block
    languagebash
    themeEmacs
    titleStart Server
    gfsh>start locator --name=locator --bind-address=localhost --port=10334
    ...
    gfsh>start server --name=server --serverbind-portaddress=40404localhost --bindserver-addressport=localhost40404
    ...
    gfsh>create region --name=SampleData --type=REPLICATE
    Member | Status
    ------ | ----------------------------------------
    server | Region "/SampleData" created on "server"
  4. Locate Extract the Protobuf message definition artifact in artifacts from the downloaded Geode release, e.g.,: $GEODE_HOME/tools/ClientProtocol/v1/geode-protobuf-definitions-{versionNumber}<version-number>.zip.
  5. Unzip Protobuf protocol Generate the language bindings from the message definitions . Using using the relevant target language Protobuf library , generate the language bindings from the message definitionsusing 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. Write byte 110 Set up communication with the server. Within your application, write byte 0x6E (decimal 110) to the socket to set up select Protobuf communication's mode. Then write byte byte 0x01 (decimal 1) to the socket , to indicate the major version number of the Protobuf the Protobuf message definitions that are to be used.
  8. Build 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.

    Code Block
    languagejs
    themeEmacs
    titlehandshakeRequest
    message {
        handshakeRequest {
            majorVersion: 1
    	    minorVersion: 1
    	}
    }
    Code Block
    languagejs
    themeEmacs
    titlehandshakeResponse
    message {
        handshakeResponse {
            serverMajorVersion: 1
            serverMinorVersion: 1
            handshakePassed: true
        }
    }
  9. Build 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.

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

    Code Block
    languagebash
    themeEmacs
    titleVerify Put
    gfsh>get --region=SampleData --key=foo
    Result      : true
    Key Class   : java.lang.String
    Key         : foo
    Value Class : java.lang.String
    Value       : bar

...