Skip to content

KSQL

This provider is designed to bring the power of one of the most popular streaming platforms: Apache Kafka and be able to plug it with ChartFactor by using its own query language: KSQL.

KSQL is developed by Confluent and is defined as:

KSQL IS AN OPEN SOURCE STREAMING SQL ENGINE THAT IMPLEMENTS CONTINUOUS, INTERACTIVE QUERIES AGAINST APACHE KAFKA™. IT ALLOWS YOU TO QUERY, READ, WRITE, AND PROCESS DATA IN APACHE KAFKA IN REAL-TIME, AT SCALE USING SQL COMMANDS.

Through ChartFactor’s aql, we can define queries that will be translated into KSQL. And the streamed data will be rendered in the visuals as it arrives.

Include the library:

1
<script src="./CFT-ksql-provider.min.js"></script>
1
2
3
4
5
6
// define providers
var providers = [{
    name:'KSQL',
    provider:'ksql',
    url:'http://localhost:9098'
}]

Then, as in with any other provider, use the setProviders() method of ChartFactor to set your data provider definitions:

1
cf.setProviders(providers);

This assumes you have a running instance of KSQL and the Confluent Platform. Refer to Confluent's KSQL installation documents for setps to install a KSQL server.

Since the data queried to the server and displayed in the visuals is live data, it doesn’t support sorting. It means that the .sort() option that can be specified to the attributes will be ignored.

Supported Aggregations Out-Of-The-Box

SUM

1
    var metric = cf.Metric("amount","sum");

AVG

1
    var metric = cf.Metric("amount","avg");

MIN

1
    var metric = cf.Metric("amount","min");

MAX

1
    var metric = cf.Metric("amount","max");

Dependencies

  • None