Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBM/sarama Go client library for Apache Kafka support #68

Merged
merged 51 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
442d385
UI: Added UI html and js for upload. Endpoint is not yet there.
matskramer Jun 4, 2024
c3e4797
UI: First version of backend to upload using UI
matskramer Jun 4, 2024
c70404a
UI: Using gin to bind to JSON
matskramer Jun 11, 2024
32fbfc8
UI: Added a TODO to remove code if custom bind functions don't gets f…
matskramer Jun 12, 2024
cf4863d
Added debug ability for a service in GoLand running in docker started…
matskramer Jun 12, 2024
3126db5
UI: renamed an import alias
matskramer Jun 13, 2024
8ad4ae7
Kafka: first simple config of Kafka with kRaft for docker-compose
matskramer Jun 24, 2024
b15a8f2
Kafka: git ignores files in volumes kraft-data
matskramer Jun 24, 2024
7bc4ed9
Kafka: First sending of message to topic-mock-next in kafka (prototyp…
matskramer Jun 24, 2024
d750bb3
Kafka: added som debug printf values
matskramer Jun 24, 2024
216dab8
Kafka: improved kafka config
matskramer Jun 25, 2024
e56bd47
Kafka: gitignore
matskramer Jun 25, 2024
06adad3
Kafka: gitignore
matskramer Jun 25, 2024
db580be
Kafka: finally a correct gitignore pattern
matskramer Jun 25, 2024
f559efb
Kafka: First working prototype of consuming from a Kafka topic
matskramer Jun 26, 2024
b66d4cd
Kafka: Improved prototype of consuming from a Kafka topic
matskramer Jun 26, 2024
31c8053
Kafka: First working prototype flow: web ->UI->Kafka->Mockas->Upload
matskramer Jun 26, 2024
9e6a6f1
Kafka: Two kafka brokers for same topic (first working prototype)
matskramer Jun 27, 2024
5c760a5
Kafka: added some prototype usage of headers and metadata in a Kafka …
matskramer Jul 1, 2024
84d9277
Kafka: improved some logging and error messages
matskramer Jul 1, 2024
9bc800d
Kafka: messaging consumption using throttling with exponential backof…
matskramer Jul 1, 2024
38d594e
Kafka: just added some TODOs
matskramer Aug 15, 2024
c315036
Kafka: Configuration now controls if Kafka should be used or not
matskramer Aug 15, 2024
1528943
Kafka: Improved logging and some smaller refactoring (names)
matskramer Aug 15, 2024
f0c43f9
Kafka: Added endpoint health (status) to MockAS API
matskramer Aug 16, 2024
bedcda4
Kafka: Two brokers with replication and two mockas service instances …
matskramer Aug 27, 2024
1aebb76
Kafka: Common kafka message producer to be used by services who needs…
matskramer Aug 29, 2024
023a618
Kafka: First prototype version of common kafka message consumer to be…
matskramer Aug 30, 2024
80a1cb1
Kafka: Common kafka message producer
matskramer Sep 2, 2024
a69c227
Kafka: Concept for: Produce and consume messages in chains. Producer …
matskramer Sep 4, 2024
3ca2220
Kafka: Improved logging and error handling
matskramer Sep 6, 2024
7c20371
Kafka: Improved logging and error handling
matskramer Sep 6, 2024
9377b6d
Kafka: kafka client created in main for ui
matskramer Sep 18, 2024
de93d70
Kafka: user UID and GID that is running Kafka is set using a ".env" f…
matskramer Sep 18, 2024
6f89477
Removed .env from version controll - NO SENSITIVE DATA EXISTED IN THE…
matskramer Sep 18, 2024
a9c86e8
Kafka: More .env properties possible to set for kafka. Updated docker…
matskramer Sep 18, 2024
a1690b1
Kafka: EventPublisher is the generic interface used to publish events…
matskramer Sep 19, 2024
03811a9
Kafka: EventConsumer is the generic interface used to consume events …
matskramer Sep 19, 2024
56720d7
Kafka: Newer versions of sarama and grpc and their dependencies
matskramer Sep 23, 2024
788b378
Kafka: removed .env file, all config values are now back in docker-co…
matskramer Sep 24, 2024
92722ce
Kafka: commit after rebase, services starts but api not refactored to…
matskramer Sep 25, 2024
f0db23e
UI: apiv28 portal->document/list
matskramer Sep 26, 2024
1454bb7
Kafka and UI: supports apiv28
matskramer Sep 27, 2024
905e68f
Kafka: fixed some minor TODOs
matskramer Sep 30, 2024
b4adf9d
Diagram over sync and async upload flow.
masv3971 Oct 1, 2024
8070017
fmt.
masv3971 Oct 1, 2024
e32337d
Fixed some of the review comments -starting in docker and works after…
matskramer Oct 2, 2024
497f72e
Fixed some of the review comments - inbound/outbound for kafka
matskramer Oct 2, 2024
0aa0056
Go Remote debugging of service ui in JetBrains Goland now works again…
matskramer Oct 2, 2024
5d43b6a
Refactorings after review nr 2
matskramer Oct 4, 2024
5b3aa38
Refactorings after review nr 3
matskramer Oct 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ pki/*
!pki/create_pki.sh
redis-data/
.idea/
kraft[0-9]*-data/
*.orig
**/.*.orig
.env

6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ build-ui:

docker-build: docker-build-verifier docker-build-registry docker-build-persistent docker-build-mockas docker-build-apigw docker-build-issuer docker-build-ui

docker-build-goland-debug: docker-build-verifier docker-build-registry docker-build-persistent docker-build-mockas docker-build-apigw docker-build-issuer docker-build-ui-goland-debug

docker-build-gobuild:
$(info Docker Building gobuild with tag: $(VERSION))
docker build --tag $(DOCKER_TAG_GOBUILD) --file dockerfiles/gobuild .
Expand Down Expand Up @@ -107,6 +109,10 @@ docker-build-ui:
$(info Docker building ui with tag: $(VERSION))
docker build --build-arg SERVICE_NAME=ui --tag $(DOCKER_TAG_UI) --file dockerfiles/ui_worker .

docker-build-ui-goland-debug:
$(info Docker building ui with tag: $(VERSION))
docker build --build-arg SERVICE_NAME=ui --tag $(DOCKER_TAG_UI) --file dockerfiles/ui_worker_goland_debug .

docker-push-gobuild:
$(info Pushing docker images)
docker push $(DOCKER_TAG_GOBUILD)
Expand Down
24 changes: 23 additions & 1 deletion cmd/apigw/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"vc/internal/apigw/apiv1"
"vc/internal/apigw/db"
"vc/internal/apigw/httpserver"
"vc/internal/apigw/inbound"
"vc/internal/apigw/outbound"
"vc/internal/apigw/simplequeue"
"vc/pkg/configuration"
"vc/pkg/kvclient"
Expand Down Expand Up @@ -59,16 +61,36 @@ func main() {
panic(err)
}

var eventPublisher apiv1.EventPublisher
if cfg.Common.Kafka.Enabled {
var err error
eventPublisher, err = outbound.New(ctx, cfg, tracer, log)
if err != nil {
panic(err)
}
services["eventPublisher"] = eventPublisher
} else {
log.Info("EventPublisher disabled in config")
}

apiv1Client, err := apiv1.New(ctx, kvClient, dbService, simpleQueueService, tracer, cfg, log.New("apiv1"))
if err != nil {
panic(err)
}
httpService, err := httpserver.New(ctx, cfg, apiv1Client, tracer, log.New("httpserver"))
httpService, err := httpserver.New(ctx, cfg, apiv1Client, tracer, log.New("httpserver"), eventPublisher)
services["httpService"] = httpService
if err != nil {
panic(err)
}

eventConsumer, err := inbound.New(ctx, cfg, log, apiv1Client, tracer)
if err != nil {
panic(err)
}
if eventConsumer != nil {
services["eventConsumer"] = eventConsumer
}

// Handle sigterm and await termChan signal
termChan := make(chan os.Signal, 1)
signal.Notify(termChan, syscall.SIGINT, syscall.SIGTERM)
Expand Down
13 changes: 12 additions & 1 deletion cmd/mockas/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"syscall"
"vc/internal/mockas/apiv1"
"vc/internal/mockas/httpserver"
"vc/internal/mockas/inbound"
"vc/pkg/configuration"
"vc/pkg/logger"
"vc/pkg/trace"
Expand All @@ -32,6 +33,8 @@ func main() {
if err != nil {
panic(err)
}
mainLog := log.New("main")

tracer, err := trace.New(ctx, cfg, log, "vc", "mock_as")
if err != nil {
panic(err)
Expand All @@ -41,19 +44,27 @@ func main() {
if err != nil {
panic(err)
}

httpService, err := httpserver.New(ctx, cfg, apiv1Client, tracer, log.New("httpserver"))
services["httpService"] = httpService
if err != nil {
panic(err)
}

eventConsumer, err := inbound.New(ctx, cfg, log, apiv1Client, tracer)
matskramer marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
panic(err)
}
if eventConsumer != nil {
services["eventConsumer"] = eventConsumer
matskramer marked this conversation as resolved.
Show resolved Hide resolved
}

// Handle sigterm and await termChan signal
termChan := make(chan os.Signal, 1)
signal.Notify(termChan, syscall.SIGINT, syscall.SIGTERM)

<-termChan // Blocks here until interrupted

mainLog := log.New("main")
matskramer marked this conversation as resolved.
Show resolved Hide resolved
mainLog.Info("HALTING SIGNAL!")

for serviceName, service := range services {
Expand Down
16 changes: 15 additions & 1 deletion cmd/ui/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"time"
"vc/internal/ui/apiv1"
"vc/internal/ui/httpserver"
"vc/internal/ui/outbound"
"vc/pkg/configuration"
"vc/pkg/logger"
"vc/pkg/trace"
Expand Down Expand Up @@ -45,7 +46,20 @@ func main() {
panic(err)
}

apiClient, err := apiv1.New(ctx, cfg, tracer, log.New("ui_api_client"))
var eventPublisher apiv1.EventPublisher
if cfg.Common.Kafka.Enabled {
var err error
eventPublisher, err = outbound.New(ctx, cfg, tracer, log)
if err != nil {
panic(err)
}
services["eventPublisher"] = eventPublisher
} else {
log.Info("EventPublisher disabled in config")
}

apiClient, err := apiv1.New(ctx, cfg, tracer, eventPublisher, log.New("api_client"))
services["apiClient"] = apiClient
if err != nil {
panic(err)
}
Expand Down
5 changes: 5 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ common:
base_url: "https://deutsche-rentenversicherung.de"
recovery_level: 2
size: 256
kafka:
enabled: true
brokers:
- "kafka0:9092"
- "kafka1:9092"

authentic_sources:
SUNET:
Expand Down
Loading
Loading