- Download Protobuf for the target language of choice.
- Download the latest release of Geode.
Start a Geode server with the following
gfsh
commands:Start Servergfsh>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"
- Locate Protobuf message definition artifact in the downloaded Geode release, e.g.,
$GEODE_HOME/tools/ClientProtocol/geode-protobuf-definitions-{versionNumber}.zip.
Unzip Protobuf protocol message definitions. Using the relevant target language Protobuf library, generate the language bindings from the message definitions.
- Create your application that connects a TCP socket to the server running on the
localhost
, on port40404
. - Write byte
110
to the socket to set up Protobuf communication's mode. Then write byte 1 to the socket, to indicate the major version number of the Protobuf message definitions that are to be used. 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.
handshakeRequestmessage { handshakeRequest { majorVersion: 1 minorVersion: 1 } }
handshakeResponsemessage { handshakeResponse { serverMajorVersion: 1 serverMinorVersion: 1 handshakePassed: true } }
Build a put request message to put the value
bar
for the keyfoo
, write it in a delimited fashion to the socket, and read the put response message in a delimited fashion from it.putRequestmessage{ putRequest { regionName: "SampleData" entry { key { stringResult: "foo" } value { stringResult: "bar" } } } }
putResponsemessage{ putResponse { } }
Verify the put with the following
gfsh
command:Verify Putgfsh>get --region=SampleData --key=foo Result : true Key Class : java.lang.String Key : foo Value Class : java.lang.String Value : bar