- Download Protobuf for the target language of choice, build it, and install it.
- Download the latest pre-built release of Geode and install it.
Start a Geode locator, start a Geode server, and create a region with the following
gfsh
commands:Code Block language bash theme Emacs title 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"
- Extract the Protobuf message definition artifacts from the Geode release:
$GEODE_HOME/tools/ClientProtocol/v1/geode-protobuf-definitions-<version-number>.zip.
Generate the language bindings from the message definitions using the relevant target language Protobuf library using the appropriate Protobuf utility such as
protoc
.- Create your application that connects a TCP socket to the server running on the host
localhost
on port40404
. - Set up communication with the server. Within your application, write byte
0x6E
(decimal 110) to the socket to select Protobuf communication. Then write byte0x01
(decimal 1) to the socket to indicate the major version number of the Protobuf message definitions that are to be used. 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 language js theme Emacs title handshakeRequest message { handshakeRequest { majorVersion: 1 minorVersion: 1 } }
Code Block language js theme Emacs title handshakeResponse message { handshakeResponse { serverMajorVersion: 1 serverMinorVersion: 1 handshakePassed: true } }
To exercise the protocol to interact with the server, within your application 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.Code Block language js theme Emacs title putRequest message{ putRequest { regionName: "SampleData" entry { key { stringResult: "foo" } value { stringResult: "bar" } } } }
Code Block language js theme Emacs title putResponse message{ putResponse { } }
Outside your application, verify that the put request message took effect with the following
gfsh
command:Code Block language bash theme Emacs title Verify Put gfsh>get --region=SampleData --key=foo Result : true Key Class : java.lang.String Key : foo Value Class : java.lang.String Value : bar
...