Compare commits

..

2 Commits

Author SHA1 Message Date
405fa5ec52
feature: add consumer code 2023-06-16 07:21:33 +02:00
be69809fd0
feature: develop kafka consumer and producer 2023-06-16 07:20:54 +02:00
3 changed files with 6 additions and 10 deletions

View File

@ -1,18 +1,15 @@
.PHONY: build-producer build-consumer run dependencies infrastructure-local infrastructure-prod topic-scram topic-ssl consume-topic .PHONY: build
ACTION=apply ACTION=apply
build-producer: dependencies build: dependencies
go build -o out/kafka-producer ./cmd/producer.go go build -o out/kafka ./cmd/main.go
build-consumer: dependencies
go built -o out/kafka-consumer ./cmd/consumer.go
dependencies: dependencies:
go mod tidy go mod tidy
run: run:
./out/kafka-producer -c ./configuration.yaml ./out/kafka -c ./configuration.yaml
infrastructure-local: infrastructure-local:
cd manifest && \ cd manifest && \

View File

@ -2,7 +2,6 @@ package main
import ( import (
. "antoine-roux.tk/kafka/internal/configuration" . "antoine-roux.tk/kafka/internal/configuration"
"fmt"
"github.com/Shopify/sarama" "github.com/Shopify/sarama"
"log" "log"
_ "net/http/pprof" _ "net/http/pprof"
@ -30,7 +29,7 @@ func main() {
_, _, err := producer.SendMessage(&sarama.ProducerMessage{ _, _, err := producer.SendMessage(&sarama.ProducerMessage{
Topic: string(application.EmitterTopic), Topic: string(application.EmitterTopic),
Key: nil, Key: nil,
Value: sarama.StringEncoder(fmt.Sprintf("test number %d", i)), Value: sarama.StringEncoder("test"),
}) })
if err != nil { if err != nil {
log.Printf("Message delivery error %s\n", err) log.Printf("Message delivery error %s\n", err)

View File

@ -13,7 +13,7 @@ kafka:
# k view-secret -n streaming kafka-user user.key # k view-secret -n streaming kafka-user user.key
key: <client pem key> key: <client pem key>
# k view-secret cluster-development-cluster-ca-cert ca.crt # k view-secret kafka-dev-listener-certificate ca.crt
ca: <server root certificate> ca: <server root certificate>
group-name: some-consumer-name group-name: some-consumer-name
topics: topics: