This project contains code examples for GridGain 9.
Examples are shipped as a Gradle module, so to start running you simply need
to import the provided build.gradle
file into your favourite IDE.
To run tests you need to provide a valid gridgain licence.
To do that edit the file $HOME/gradle.properties
adding the following content:
gridgain_license=<PATH_TO/gridgain_license.conf>
The following examples are included:
KeyValueViewDataStreamerExample
- demonstrates the usage of theDataStreamerTarget#streamData(Publisher, DataStreamerOptions)
API with theKeyValueView
.KeyValueViewPojoDataStreamerExample
- demonstrates the usage of theDataStreamerTarget#streamData(Publisher, DataStreamerOptions)
API with theKeyValueView
and user-defined POJOs.RecordViewDataStreamerExample
- demonstrates the usage of theDataStreamerTarget#streamData(Publisher, DataStreamerOptions)
API with theRecordView
.RecordViewPojoDataStreamerExample
- demonstrates the usage of theDataStreamerTarget#streamData(Publisher, DataStreamerOptions)
API with theRecordView
and user-defined POJOs.ReceiverStreamProcessingExample
- demonstrates the usage of theDataStreamerTarget#streamData(Publisher, Function, Function, ReceiverDescriptor, Subscriber, DataStreamerOptions, Object)
API for stream processing of the trades data read from the file.ReceiverStreamProcessingWithResultSubscriberExample
- demonstrates the usage of theDataStreamerTarget#streamData(Publisher, Function, Function, ReceiverDescriptor, Subscriber, DataStreamerOptions, Object)
API for stream processing of the trade data and receiving processing results.ReceiverStreamProcessingWithTableUpdateExample
- demonstrates the usage of theDataStreamerTarget#streamData(Publisher, Function, Function, ReceiverDescriptor, Subscriber, DataStreamerOptions, Object)
API for stream processing of the trade data and updating account data in the table.ContinuousQueryExample
- demonstrates the usage of theContinuousQuerySource
API.ContinuousQueryTransactionsExample
- demonstrates the usage of theContinuousQuerySource
API with transactions.ContinuousQueryResumeFromWatermarkExample
- demonstrates the usage of theContinuousQuerySource
API resuming from a specific watermark.ComputeAsyncExample
- demonstrates the usage of theIgniteCompute#executeAsync(JobTarget, JobDescriptor, Object)
API.ComputeBroadcastExample
- demonstrates the usage of theIgniteCompute#execute(BroadcastJobTarget, JobDescriptor, Object)
API.ComputeCancellationExample
- demonstrates the usage of theIgniteCompute#executeAsync(JobTarget, JobDescriptor, Object, CancellationToken)
API.ComputeColocatedExample
- demonstrates the usage of theIgniteCompute#execute(JobTarget, JobDescriptor, Object)
API with colocated JobTarget.ComputeExample
- demonstrates the usage of theIgniteCompute#execute(JobTarget, JobDescriptor, Object)
API.ComputeJobPriorityExample
- demonstrates the usage of theIgniteCompute#execute(JobTarget, JobDescriptor, Object)
API with different job priorities.ComputeMapReduceExample
- demonstrates the usage of theIgniteCompute#executeMapReduce(TaskDescriptor, Object)
API.ComputeWithCustomResultMarshallerExample
- demonstrates the usage of theIgniteCompute#execute(JobTarget, JobDescriptor, Object)
API with a custom result marshaller.ComputeWithResultExample
- demonstrates the usage of theIgniteCompute#execute(JobTarget, JobDescriptor, Object)
}` API with a result return.SqlDdlExample
- demonstrates the DDL capabilities of SQL engine via thin client.SqlJdbcCopyExample
- demonstrates the usage of theCOPY
command via JDBC driver.SqlJdbcExample
- demonstrates the usage of the basic sql queries via JDBC.
Then, to run tests, invoke:
./gradlew :integrationTest
- Start a GridGain node:
docker run --name gridgain9-node -d --rm -p 10300:10300 -p 10800:10800 \
-v $(pwd)/config/gridgain-config.conf:/opt/ignite/etc/gridgain-config.conf gridgain/gridgain9
- Get the IP address of the node:
NODE_IP_ADDRESS=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' gridgain9-node)
- Initialize the node:
docker run -v <PATH_TO_GRIDGAIN_LICENSE_FILE>:/opt/gridgain9cli/license.conf gridgain/gridgain9 \
cli cluster init --url http://$NODE_IP_ADDRESS:10300 --name myCluster1 --metastorage-group defaultNode \
--config-files=/opt/gridgain9cli/license.conf
-
Run the example via IDE.
-
Stop the GridGain node:
docker stop gridgain9-node
-
Download the GridGain ZIP package including the database and CLI parts. Unpack.
-
Prepare the environment variables.
GRIDGAIN_HOME
is used in the GridGain startup. Therefore, you need to export it:
export GRIDGAIN_HOME=/path/to/gridgain9-db-dir
export GRIDGAIN_CLI_HOME=/path/to/gridgain9-cli-dir
- Override the default configuration file:
echo "CONFIG_FILE=config/gridgain-config.conf" >> $GRIDGAIN_HOME/etc/vars.env
- Start an GridGain node using the startup script from the database part:
$GRIDGAIN_HOME/bin/gridgain9db
- Initialize the cluster using GridGain CLI from the CLI part:
$GRIDGAIN_CLI_HOME/bin/gridgain9 cluster init --name myCluster1 --metastorage-group defaultNode --config-files=<PATH_TO_GRIDGAIN_LICENSE_FILE>
-
Run the example from the IDE.
-
Stop the GridGain node by stopping the gridgain9db process. See additional details here: https://www.gridgain.com/docs/gridgain9/latest/quick-start/getting-started-guide#stop-the-node