Skip to content

Using the Sample Program for the kdb Insights C# Interface

This page describes how to use our sample C# program, available on the KX Downloads Portal, to:

  • Publish data from the sample.csv file to either:
    • kdb Insights Reliable Transport
    • A kxi-db package inside the kdb Insights Enterprise. You can download this package using these instructions.
  • Subscribe to data from kdb Insights

Downloading

The RTHelper.<version>.<os>.nupkg, which you can download from the KX Downloads Portal, contains the following files:

  • CsvUpload.cs
  • OneRecordUpload.cs
  • BatchUpload.cs
  • SubscriberExample.cs
  • sample.csv

Before using the sample program you must install the C# interface.

Unzipping

Unzip the .nupkg to access the sample programs.

unzip RTHelper.$version.$os.nupkg

Publishing

To execute the sample program to publish data to an RT stream, use the following commands:

cd samples/CsvUpload
dotnet build
dotnet run -- -u <configUrl> -s "sensorID:int,captureTS:ts,readTS:ts,valFloat:float,qual:byte,alarm:byte" -t trace -i sample.csv

The -u argument can be either:

  • a kdb Insights Enterprise client URL or
  • a URL to a local JSON file (file://...) containing the RT configuration.

See the Getting Started Guide for further information on obtaining such a URL.

The program will upload the sample.csv file and then exit.

Subscribing

To execute the sample program to subscribe to data, use the following commands:

cd samples/SubscriberExample
dotnet build
dotnet run -- <filter> <loglevel> <RT sub_server endpoint>

The program will subscribe to data from an RT stream and display the messages on the console.