Enriching data streams
This page describes a tutorial to enrich a Kafka topic using Lenses SQL Processors.
In this article, we will be enriching customer call events with their customer details.
Enriching data streams with extra information by performing an efficient lookup is a common scenario for streaming SQL on Apache Kafka.
Topics involved:
customer_detailsmessages contain information about the customercustomer_call_detailsmessages contain information about calls
Streaming SQL enrichment on Apache Kafka
SET defaults.topic.autocreate=true;
INSERT INTO customers_callInfo
SELECT STREAM
calls._value AS call
, customer._value AS customer
FROM customer_call_details AS calls
INNER JOIN (SELECT TABLE * FROM customer_details) AS customer
ON customer._key.customer.id = calls._key.customer.idTesting data
To simplify our testing process and manage to run the above example in less than 60 seconds, we will be using SQL to create and populate the three Apache Kafka topics:
CREATE TOPIC customer_details
customer_detailsPOPULATE TOPIC customer_details
customer_detailsCREATE TOPIC customer_call_details
customer_call_detailsPOPULATE TOPIC customer_call_details
customer_call_detailsValidate results
Last updated
Was this helpful?

