Skip to content

Analytics and Real-Time Engine

This page covers inspecting the Real-Time Database (RDB) to verify your setup, writing a custom q analytic in KX Analyst, and creating the real-time engine (RTE) that will publish simulated telemetry data into the system.

Inspect the RDB with KX Analyst

At this step, you'll examine running processes using KX Analyst. You'll connect to the RDB and verify that data is being captured correctly and will be written to the HDB by the end-of-day job.

KX Analyst is a visual environment for exploring and managing datasets in real-time using kdb+ server-based analytics.

Refer to the KX Analyst site for full documentation.

Connect to the running RDB

Follow these steps to open the IDE on the airTelRDB.1 task:

  1. In Process Library Status, find the task associated with the airTelRDB instance.
  2. Right-click the task and select Connect (or open the IDE from the task context menu).
  3. Expand the global tables folder to see available tables.

    Expand global tables

Run verification commands

Run each of the following commands in sequence using Ctrl+D when on the same line as the command or right-click > Display:

Command Expected output
system "pwd"; /home/yourhomedir/kxinstall/delta-data/airTelData/hdbData
tables[]; `s#`airTelTelemetry`dxState
count airTelTelemetry; 0 (no data yet — this is correct)
select from airTelTelemetry; An empty table with the correct column headers:

timestamp aircraftId altitude speed temperature pressure
--------------------------------------------------------

Unexpected results

If any results are unexpected, review the configuration steps for all components before continuing.

Create analytics

To feed simulated telemetry into the system, you will create a custom q analytic function in KX Analyst, then export it to KX Control so the RTE process can use it.

Open a workspace

  1. From the KX Delta Platform home page, click KX Analyst.
  2. Leave all popup parameters as-is and click Connect.
  3. Name the workspace airTelWorkspace.

Set up a Git repository (Optional)

KX Analyst supports Git integration for version control and collaboration. You can either create a local repository without Git integration or clone an existing Git repository into KX Analyst.

Create a repository without Git

Use this option if you do not need source control integration.

  1. In the workspace panel, right-click and select Repository.
  2. Enter a repository name.
  3. Leave the Origin field blank to automatically generate it from the repository name.
  4. Click OK to create the repository.

The repository is now available in the workspace, where you can add modules and functions and export them to KX Control.

Clone a repository with Git

Use this option if your project is managed in Git.

  1. Create (or obtain access to) a Git repository and copy its SSH path.
  2. Copy the repository clone URL using the repository’s Code button.
  3. Right click in the KX Analyst workspace panel and choose Git > Clone.
  4. Enter your repository URL in the Origin field and the SSH key copied previously, then click OK.

    Enter credential for the cloned repo

  5. Click OK again when the Pull Repository dialog shows to clone the repository locally.

    Clone Repo

The cloned repository will appear in the workspace tree and is ready for development and version-controlled changes.

Test the dummy data function in a q Scratchpad

In the default q Scratchpad, enter and run the following code:

dummyTelemetry:([]
    timestamp:    .z.p;
    aircraftId:   1?`AC001`AC002`AC003`AC004`AC005`AC006`AC007`AC008`AC009`AC010;
    altitude:     first 42000 +1?100;
    speed:        first 600 +1?50;
    temperature:  first -10 +1?20;
    pressure:     first 800 +1?200
    )

Highlight the code and press Ctrl+D to display the result. You should see a single row similar to:

timestamp                     aircraftId altitude speed temperature pressure
----------------------------------------------------------------------------
2026.04.12D10:25:16.620806511 AC005      42002    609   1           886

Run it several times and observe the values changing slightly each time.

Note

If you see errors, try placing all the code on a single line and adjust the tabbing until it runs.

Create a module

  1. Right-click the air-tel-metrics-repo module in the tree on the left and select New > Module.
  2. Name it airTelDummyData and click OK.

Create the load function

  1. Right-click the airTelDummyData module and select New > Function.

  2. Using dot notation, name the function .airTelDummyData.loadDummyData. This syntax correctly associates the function with its parent module.

  3. You will be given an empty function definition template. Enter the following code into the editor:

    // @fileOverview Function to publish simulated aircraft telemetry data that varies slightly each call, within limits.
    // @returns {Type} Does not return anything. 
    {[]
        dummyTelemetry:([]
            timestamp:    .z.p;
            aircraftId:   1?`AC001`AC002`AC003`AC004`AC005`AC006`AC007`AC008`AC009`AC010;
            altitude:     first 42000 +1?100;
            speed:        first 600 +1?50;
            temperature:  first -10 +1?20;
            pressure:     first 800 +1?200
            )
        }
    
  4. Click Save, then open a q scratchpad and execute the function by running the following code. Use Ctrl+D or right-click > Display to view the result.

    .airTelDummyData.loadDummyData[]
    

    You should see a single row similar to:

    timestamp                     aircraftId altitude speed temperature pressure
    ----------------------------------------------------------------------------
    2026.04.12D11:00:33.530935922 AC005      42083    638   -4          993
    
  5. Now make a single change to the function so that the dummy data is published to a table and all its subscribers. Add a semicolon to close the table definition, then add the .d.pub call on the final line:

    // @fileOverview Function to publish simulated aircraft telemetry data that varies slightly each call, within limits.
    // @returns {Type} Does not return anything. 
    {[]
        dummyTelemetry:([]
            timestamp:    .z.p;
            aircraftId:   1?`AC001`AC002`AC003`AC004`AC005`AC006`AC007`AC008`AC009`AC010;
            altitude:     first 42000 +1?100;
            speed:        first 600 +1?50;
            temperature:  first -10 +1?20;
            pressure:     first 800 +1?200
            );
        .d.pub[`airTelTelemetry;dummyTelemetry];
        }
    

    Note

    Note the semicolon at the end of the table definition closing bracket ) — this is required before calling .d.pub. The .d.pub call publishes the generated row to airTelTelemetry and notifies all subscribers.

  6. Click Save.

Export the analytic to KX Control

Warning

Pushing a module to KX Analyst does not automatically make it available in KX Control. You must explicitly export it.

  1. Right-click the airTelDummyData analytic and select Control > Export as Analytic Group(s).
  2. Click OK.
  3. Confirm the success message appears in the bottom-left of your screen.

Create a real-time engine (RTE)

To feed dummy data into the system that matches the schema created earlier, you must configure both the analytic defined in the previous section and a Real-Time Engine (RTE) process. In this section, you will create the RTE process, associate the analytic with it using the initialStateFunct function, and add the process to the workflow. Before updating the workflow configuration, you will verify that the function used by the RTE process correctly publishes data to its associated RDB process.

The real-time engine (RTE) will run the loadDummyData function to generate and publish simulated telemetry records to the metrics plant.

Create the RTE process

  1. Switch to the KX Control browser tab.
  2. Right-click the Process Library and select New > Process Instance.
  3. Name the instance airTelRTE, select the airTelPackage as the package, set the template to DS_RTE, and click Add.
  4. In Instance Details, add a description.
  5. In Reserved Params, set:
    • Host: localhost
    • Port: 8004
  6. In Instance Params, set:

    • messagingServer: DS_MESSAGING_SERVER:airTelMessagingServer
    • publishChannel: datafeed
    • publishTableList: airTelTelemetry

    Why is publishTableList important?

    When the RTE publishes data, the messaging server notifies all processes that have subscribed to the datafeed channel. This keeps the RDB (and any other subscribers) current.

  7. In the Schemas subtab, associate airTelSchemaGroup.

  8. In the Analytics subtab, associate the airTelDummyData group.
  9. Click Save.

Start the workflow and RTE

  1. Start airTelWorkflow and confirm all components are green in the Graph view.
  2. Start airTelRTE separately.
  3. Review the partial log for airTelRTE and confirm a line similar to the following appears:

    Messaging - adding subscription ### (`airTelMetricsPlant.1;`sourceId`consumerId`topic`channel!(22806531i;22806529i;,\"airTelTelemetry\";,`datafeed))
    

Execute the function and verify data

  1. Connect to the RTE process by right-clicking the airTelRTE task in the Process Library and selecting Connect.
  2. In the connected session, open the (Global) module and table folder, then open the q scratchpad.

    Note

    This is the typical setup when working with an instance. The left panel displays the code modules available within the process. Note that the airTelTelemetry table is present.

    RTE workspace

  3. In the q scratchpad, run tables[]; and confirm airTelTelemetry is listed.

  4. Next, execute the function that generates simulated aircraft telemetry data. Execute the following command three times:

    .airTelDummyData.loadDummyData[];
    

    Note

    Each execution publishes a new telemetry record. When data is added to the published tables, the messaging server notifies subscribed processes so they can update automatically.

  5. Open a connection to the airTelRDB process and run the following command to inspect the contents of the airTelTelemetry table:

    select from airTelTelemetry;
    

    You should see three rows:

    timestamp                     aircraftId altitude speed temperature pressure
    ----------------------------------------------------------------------------
    2026.04.15D10:51:37.394012852 AC008      42070    615   1           819
    2026.04.15D10:51:40.852280353 AC005      42025    625   -3          895
    2026.04.15D10:51:50.505985028 AC010      42045    606   -4          838
    

    Experiment by running the function more times and watching the RDB grow.

Troubleshooting — if no data appears:

  • Have you associated the schemas with both the RTE and RDB?
  • Have you associated the analytic module with the RTE?
  • Is the RDB subscribed to datafeed?
  • Is the RTE publishing to datafeed with airTelTelemetry declared?
  • Is the messaging server connected via the config parameter in both RTE and RDB?
  • Does the config parameter table have any blank lines?

Next step

Proceed to Automation and dashboard to automate the data feed on a timer and build a live dashboard to visualize the telemetry.