- Acquire Download Protobuf libraries for for the target language of choice, build it, and install it.
- Download the latest release of 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 Start Server gfsh>start locator --name=locator --bind-address=localhost --port=10334 ... gfsh>startstart server --name=server --bind-address=localhost --server-port=40404 --J=-Dgeode.feature-bindprotobuf-address=localhost createprotocol=true ... gfsh>create region --name=SampleData --type=REPLICATE
- Locate Protobuf message definition artifact from the downloaded Geode release in directory ---> add directory here.
Member | Status ------ | ---------------------------------------- server | Region "/SampleData" created on "server"
- Extract the Protobuf message definition artifacts from the Geode release:
$GEODE_HOME/tools/ClientProtocol/geode-protobuf-definitions-<version-number>.zip.
Generate Using the Protobuf library, generate the language bindings from the message definitions downloaded in the previous step.using the relevant target language Protobuf library using the appropriate Protobuf utility such as
protoc
. Example:Code Block $PROTOBUF/bin/protoc -I=$PROTOBUF/include/ -I=`pwd` --java_out=`pwd` v1/*.proto
- Create your application that connects In the target language, connect a TCP socket to the server running on the local host and host
localhost
on port40404
. <--- correct port Within your application, build a NewConnectionHandshake message, write it in a delimited fashion
Write byte 110to the socket.
- Write the handshake message to the socket.
- Read the handshake response from the socket.
- Write the put message to the socket.
Code Block language js theme Emacs title handshakeRequest NewConnectionHandshake{ majorVersion: 1 minorVersion: 1 }
Read the handshake response message in a delimited fashion from your socket. Note that your implementation language may not provide an API to explicitly read and/or write delimited messages. These messages are prepended with the message length encoded as a varint value. If you do not have an appropriate API, you may need to read and decode this value first, in order to determine how much data to read from the network to receive a complete message.
Also be aware that messages may not arrive in one packet and may require multiple read() calls to receive all data from the network. The response should match the following:Code Block language js theme Emacs title handshakeResponse HandshakeAcknowledgement { 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 { request { putRequest { regionName: "SampleData" entry { key { stringResult: "foo" } value { stringResult: "bar" } } } }
Code Block language js theme Emacs title putResponse message { response { putResponse {} } }
If an error occurs, your message will contain an ErrorResponse:Code Block language js theme Emacs title errorResponse message { response { errorResponse { errorCode: 2100 message: "Region passed by client did not exist: FOO" } } }
Outside your application, verify that the put request message took effect with the following
gfsh
command:
Read the put response from the socket.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