Connecting to Apache Kafka® in Confluent® Cloud
In this tutorial
Nussknacker allows creating decision scenarios on real-time data. As one way to ingest your data, you can connect directly to your Kafka and Schema Registry to read events from and write to your topics.
In this tutorial, we will explain how to connect to the Confluent Cloud from the Nussknacker Cloud and use a managed Apache Kafka as the input and output from Nussknacker.
Prerequisites
We assume that:
- You have already created the Confluent Cloud environment and a cluster with the Governance package enabled.
- You have already created a Nussknacker Cloud account
Setting up Confluent Cloud
note
You can skip this part if you already have your configuration snippet
- Go to Confluent Cloud
- Select the proper environment and choose the cluster you want to connect to
- Go to
Clients
- Choose a Java client type
- Click
Create Kafka cluster API key
- You will be offered to download the credentials file. You can save it but it won`t be necessary for the Nussknacker Cloud
- Click
Create Schema Registry API key
- You will be offered to download the credentials file. You can save it but it won`t be necessary for the Nussknacker Cloud
- Your API keys should appear in the configuration snippet
- Copy the configuration snippet
Setting up Nussknacker Cloud
- Go to Nussknacker Cloud
- Click
Create instance
on the left panel - Choose your instance name or use autogenerated value
- Choose
Existing Kafka cluster
- Paste your configuration snippet into the
Properties
field. It will be automatically converted to a JSON representation.
- Click submit button
- Your Nussknacker instance connected to Confluent Cloud will be created within a couple of minutes
Creating a topic and a schema
- In the Confluent Cloud cluster overview go to
Topics
- Click the
Add topic
button - Type your topic name
- Set the number of partitions
- Click
Create with defaults
- Your topic is created, now let`s define a data contract
- Click the
Create schema
button - Choose your schema type, for now, Avro and JSON Schema are supported in Nussknacker Cloud
- Enter your schema
- Click the
Create
button
Creating a scenario
- Go to Nussknacker Cloud management
- Open your running Nussknacker instance with the
Open instance
button - Create your first scenario with the
Create scenario
button- Choose the preferred scenario name
- Drag and drop the
Kafka
source from the left panel - You should see your topic on the
Topic
drop-down list - Add custom logic like filtering, sending to some other
Kafka
sink - Press
deploy
button on the left - Wait a while until scenario will be deployed
Sending messages to and receiving messages from Nussknacker scenario
You can read about messaging with Nussknacker in the documentation.