Skip to content

Commit

Permalink
Merge pull request #68 from dc4eu/mk_sarama
Browse files Browse the repository at this point in the history
IBM/sarama Go client library for Apache Kafka support
  • Loading branch information
matskramer authored Oct 8, 2024
2 parents 2ff50e4 + 5b3aa38 commit 76cd279
Show file tree
Hide file tree
Showing 494 changed files with 77,956 additions and 499 deletions.
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
25 changes: 23 additions & 2 deletions 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,23 +61,42 @@ func main() {
panic(err)
}

mainLog := log.New("main")

var eventPublisher apiv1.EventPublisher
if cfg.IsAsyncEnabled(mainLog) {
var err error
eventPublisher, err = outbound.New(ctx, cfg, tracer, log)
services["eventPublisher"] = eventPublisher
if err != nil {
panic(err)
}
}

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)
}

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

// 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")
mainLog.Info("HALTING SIGNAL!")

for serviceName, service := range services {
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,7 @@ func main() {
if err != nil {
panic(err)
}

tracer, err := trace.New(ctx, cfg, log, "vc", "mock_as")
if err != nil {
panic(err)
Expand All @@ -41,19 +43,28 @@ 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)
}

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

// 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")
mainLog.Info("HALTING SIGNAL!")

for serviceName, service := range services {
Expand Down
19 changes: 17 additions & 2 deletions 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,22 @@ func main() {
panic(err)
}

apiClient, err := apiv1.New(ctx, cfg, tracer, log.New("ui_api_client"))
mainLog := log.New("main")

var eventPublisher apiv1.EventPublisher
if cfg.IsAsyncEnabled(mainLog) {
var err error
eventPublisher, err = outbound.New(ctx, cfg, tracer, log)
services["eventPublisher"] = eventPublisher
if err != nil {
panic(err)
}
} 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 All @@ -62,7 +78,6 @@ func main() {

<-termChan // Blocks here until interrupted

mainLog := log.New("main")
mainLog.Info("HALTING SIGNAL!")

for serviceName, service := range services {
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

0 comments on commit 76cd279

Please sign in to comment.