This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
In this blog we will show you how to send data from Kafka to Synapse Real-time Analytics in Fabric. Get the sample source code from GitHub fabric-kafka-sample
You will use a Fabric Eventstream to receive data from Kafka, and then send it to a KQL-database for further processing. Eventstream supports Custom Apps that are backed by an Event Hub. This makes Fabric Eventstream compatible with Kafka, so you can use any Kafka client to send data to Fabric.
If you want to learn more about how Fabric supports Kafka, check out What is Azure Event Hubs for Apache Kafka.
In addition:
Once you have your workspace, you can create an Eventstream by selecting the “Create” button, and then scrolling down until you see the Eventstream option. Full documentation on how to create an Eventstream can be found here.
Name your Eventstream “kafka-to-kql-eventstream” and select “Create.”
Sending_data_to_Synapse_Real-Time_Analytics_in_Fabric_from_Apache_Kafka_Ecosyste
Creating_a_source_called_from-kafka
Name your custom app “from-kafka”.
New_custom_app_from-kaka
Once the custom app is created, select it. You will see the EventHub connection string for your Eventstream in the Information panel at the bottom. Copy this Connection string-primary key, as you will need it later.
EventHub_connection_string
Endpoint=sb://mynamespace.servicebus.windows.net/;SharedAccessKeyName=XXXXXX;SharedAccessKey=XXXXXX;EntityPath=XXXXXX
git clone https://github.com/videlalvaro/fabric-kafka-sample cd fabric-kafka-sample/producer
We are going to send telemetry data to the Eventstream. The data is in JSON format, and looks like this:
{
"timestamp": "<timestamp>",
"temperature": 25.0,
"humidity": 13.0
}bootstrap.servers=mynamespace.servicebus.windows.net:9093 security.protocol=SASL_SSL sasl.mechanism=PLAIN sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="$ConnectionString" password="Endpoint=sb://mynamespace.servicebus.windows.net/;SharedAccessKeyName=XXXXXX;SharedAccessKey=XXXXXX;EntityPath=XXXXXX";
Endpoint=sb://mynamespace.servicebus.windows.net/;SharedAccessKeyName=XXXXXX;SharedAccessKey=XXXXXX;EntityPath=XXXXXX
mvn clean package mvn exec:java -Dexec.mainClass="TestProducer" \ -Dexec.args="<EntityIdValue>"
Sending_data_to_Synapse_Real-Time_Analytics_in_Fabric_from_Apache_Kafka_Ecosyste
Select_the_Eventstream
Once you select it, you will see the preview table below being populated with your data:
Sending_data_to_Synapse_Real-Time_Analytics_in_Fabric_from_Apache_Kafka_Ecosyste
Now, select “New destination”, and then select “KQL Database” from the dropdown menu.
New_KQL_Database_destination
Name your destination “es-to-kql”. Enter your Workspace name, and finally name your KQL Database as “es-to-kql-database”. Then select “Create and configure.”
New_destination_KQL_Database
Sending_data_to_Synapse_Real-Time_Analytics_in_Fabric_from_Apache_Kafka_Ecosyste
On the next screen, leave the default values and select “Next: Schema.”
Sending_data_to_Synapse_Real-Time_Analytics_in_Fabric_from_Apache_Kafka_Ecosyste
Then on schema wait until the data is loaded in the preview. Then select the “Data format” dropdown and choose JSON, since that is the format of our data. You will see that the preview table automatically parses the data offering the different fields as columns with the right data types.
Sending_data_to_Synapse_Real-Time_Analytics_in_Fabric_from_Apache_Kafka_Ecosyste
Select “Next: Summary.”
Now you will see the “Continuous ingestion from Eventstream established” screen. Select "Close" to finis the process of setting up your Custom App, ingesting data from Kafka, and sending it to a KQL Database.
Sending_data_to_Synapse_Real-Time_Analytics_in_Fabric_from_Apache_Kafka_Ecosyste
Sending_data_to_Synapse_Real-Time_Analytics_in_Fabric_from_Apache_Kafka_Ecosyste
This will open a new tab with your KQL Database. Select your table in the Data tree pane, and then select “Explore your data.”
Type the following query in the query editor and select “Run”:
['from-kafka-kql-table'] | take 100
Sending_data_to_Synapse_Real-Time_Analytics_in_Fabric_from_Apache_Kafka_Ecosyste
From here on you can use the KQL Database as your building block for further processing, like generating Power BI reports. For more information on how to use KQL, check out the Kusto Query Language (KQL) overview documentation.
You learned how to create an Eventstream, that uses a Custom App as source for receiving data from Kafka.
You have also run your first KQL Query, and now are ready to explore the world of real-time analytics. Time to create your first Power BI report!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.