Skip to content

Using the Java SDK sample application

This section describes how to use the sample Java program to send the a sample.csv file, or a random set of data to the sdk_sample_assembly inside the KX Insights Platform. This assembly can be downloaded using the instructions here.

The insights-java-sdk-samples.${VERSION}.zip, downloaded from the KX Insights Nexus registry, contains the following files:

  • rtdemo.jar - shadowJar that can be used send data.
  • sample.csv - a CSV file containing sample data based on the sdk-sample-assembly schema.

Note

Before using the sample program you need to download and extract the Java SDK as described here.

The source code for the sample program can be taken and edited for use inside your applications.

Publishing data from the CSV file

The first line of the CSV file contains the schema. This is a comma separated list, with each element in the format "columnName:type".

To ingest the CSV file into the KX Insights Platfrom run the following:

RT_REP_DIR=<REPLICATOR_LOCATION>
KXI_CONFIG_URL=<CONFIG_URL>
RT_LOG_PATH=<RT_LOG_PATH>
java -jar ./rtdemo-<VERSION>-all.jar --runCsvLoadDemo=<CSV_FILE>

Where the parameters are defined as follows:

parameter description
REPLICATOR_LOCATION Path where the replicator can be extracted to. It must be possible to execute a program from this location.
CONFIG_URL The URL that this program will call to find the endpoint(s) it will need to connect to. This will be in the following form 'https://{INSIGHTS_HOSTNAME}/informationservice/details/{KC_CLIENT_ID}'.
RT_LOG_PATH The location where the RT messages streams will be written to.
CSV_FILE The csv file you want to load (see the sample.csv file provided in the project as an example).

Building

If you want to build the shadowJar make sure a Java development environment is installed on your system and run the following in the root of the project.

./gradlew rtdemo:shadowJar

The resulting jar file will be in /rtdemo/build/libs/rtdemo.jar.