Skip to content

Latest commit

 

History

History
62 lines (49 loc) · 1.46 KB

README.md

File metadata and controls

62 lines (49 loc) · 1.46 KB

redpanda cloud demo

This repository contains a demo of how to connect to Redpanda Cloud using the KafkaJS library.

why?

If this application can run successfully targeting redpanda cloud, we should be confident that it will work with Strimzi clusters deployed using CNDI.

setup

  1. Create a Redpanda Cloud cluster
  2. Create a topic named "roll"
  3. Create a user with all permissions
  4. Get the username, password, and broker address for the user
# .env
KAFKA_USERNAME='foo'
KAFKA_PASSWORD='iwgno4gi5oign4woian4gio4w'
KAFKA_BROKER='w4gnwi4ngoi4wn.any.us-east-1.mpx.prd.cloud.redpanda.com:9092'
  1. Run the application
deno task serve
  1. Visit localhost:8000/roll/yourname

  2. if configured correctly, you should see a response which looks like

{
  "username": "foo",
  "roll": 1,
  "region": "unknown",
  "date": "2024-03-29T04:05:27.324Z",
  "kafka_success": true,
  "kafka_record": [
    // this part will be missing if the kafka record was not saved
    {
      "topicName": "roll",
      "partition": 0,
      "errorCode": 0,
      "baseOffset": "8",
      "logAppendTime": "-1",
      "logStartOffset": "-1"
    }
  ]
}
  1. If you'd like to listen for updates to the 'roll' topic, you can run the consume application. Remember, this is cool because it can run anywhere - it just happens to be on the same machine as the serve application.
deno task consume