Skip to content

kameshsampath/go-datastreaming-quickstart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Get Started Building Streaming App With Go

A demo to show how to use go and redpanda to build simple streaming API application using Echo Project.

Pre-requisites

Run Application

go run server.go -brokers "$RPK_BROKERS"

Start Redpanda Server

rpk container start -n 1

NOTE:

Make a note of the RPK_BROKERS value and export as instructed

Create greetings Topic

rpk topic create greetings --partitions=3 --replicas=1

Start Streaming Consumer

Open a new terminal window

http --stream ':8080/?topic=greetings'

Since the application is set to use the same Consumer Group ID of format <topic>-echo-group the consumer will not read the old messages when restarted. If you wish to read all from start run the following command,

http --stream ':8080/?topic=greetings&group=new'

This command will create a new consumer group on each request.

Produce a message

Open new terminal and run the following command to produce a new message to topic called greetings,

http -v :8080/ topic=greetings key='1' value='Hello World!'

Clean up

rpk container purge