Kafka
Apache Kafka is a distributed streaming platform. It allows you to create publishers, which create data streams, and consumers, which subscribe to and ingest the data streams produced by publishers.
You can use HeavyDB KafkaImporter C++ program to consume a topic created by running Kafka shell scripts from the command line. Follow the procedure below to use a Kafka producer to send data, and a Kafka consumer to store the data, in HeavyDB.
This example assumes you have already installed and configured Apache Kafka. See the Kafka website.
Creating a Topic
Create a sample topic for your Kafka producer.
Run the
kafka-topics.sh
script with the following arguments:Create a file named
myfile
that consists of comma-separated data. For example:Use
heavysql
to create a table to store the stream.
Using the Producer
Load your file into the Kafka producer.
Create and start a producer using the following command.
Using the Consumer
Load the data to HeavyDB using the Kafka console consumer and the KafkaImporter
program.
Pull the data from Kafka into the
KafkaImporter
program.Verify that the data arrived using
heavysql
.
Last updated