Producing Kafka Messages with Confluent REST Proxy

30 minutes
  • 2 Learning Objectives

About this Hands-on Lab

Confluent provides even more ways to interact with Kafka, such as the Confluent REST Proxy. Confluent REST Proxy serves as a “RESTful interface” on top of your Kafka cluster. In this hands-on lab, you will have the opportunity to work with Confluent REST Proxy by using it to publish some messages to Kafka topics.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Publish the Missing Records to the `inventory_purchases` Topic.
  1. Publish the records using an HTTP request to Confluent REST Proxy:

    curl -X POST -H "Content-Type: application/vnd.kafka.json.v2+json" 
    -H "Accept: application/vnd.kafka.v2+json" 
    --data '{"records":[{"key":"apples","value":"23"},{"key":"grapes","value":"160"}]}' 
    "http://localhost:8082/topics/inventory_purchases"
  2. We can verify that the data is in the topic with a console consumer:

    kafka-console-consumer --bootstrap-server localhost:9092 --topic inventory_purchases --from-beginning --property print.key=true
Publish the Missing Records to the `member_signups` Topic.
  1. Publish the records using an HTTP request to Confluent REST Proxy:

    curl -X POST -H "Content-Type: application/vnd.kafka.json.v2+json" 
    -H "Accept: application/vnd.kafka.v2+json" 
    --data '{"records":[{"key":"77543","value":"Rosenberg, Willow"},{"key":"56878","value":"Giles, Rupert"}]}' 
    "http://localhost:8082/topics/member_signups"
  2. We can verify that the data is in the topic with a console consumer:

    kafka-console-consumer --bootstrap-server localhost:9092 --topic member_signups --from-beginning --property print.key=true

Additional Resources

Your supermarket company is using Kafka to handle messaging as part of its infrastructure. Recently, some data was lost before it could be published to Kafka due to a power failure in a data center. You have been asked to publish these lost records to the necessary topics manually. Luckily, Confluent REST Proxy is installed and can be used to interact with Kafka using simple HTTP requests easily.

Using Confluent REST Proxy, publish the following records to the Kafka cluster.

Publish to the inventory_purchases topic:

  • Key: apples, Value: 23
  • Key: grapes, Value: 160

Publish to the member_signups topic:

  • Key: 77543, Value: Rosenberg, Willow
  • Key: 56878, Value: Giles, Rupert

If you get stuck, feel free to check out the solution video, or the detailed instructions under each objective. Good luck!

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!