# hericoelho/spring-kafka-docker architecture

> Architecture diagram of the GitHub repository hericoelho/spring-kafka-docker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hericoelho/spring-kafka-docker
- Repository: https://github.com/hericoelho/spring-kafka-docker

## Overview

SpringQueue is a hexagonal Spring Boot microservice for asynchronous PIX transaction processing. Its documented principal workflow accepts a REST request, publishes it to Kafka, then consumes and processes it idempotently; the consumer also has retry/backoff and dead-letter handling. The graph preserves documented resilience and observability capabilities. Source excerpts were unavailable, so relationships are limited to those stated in the root README; implementation-level details are not inferred.

Main entry points: [`springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/in/web/controller/TransactionController.java`](https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/in/web/controller/TransactionController.java) (Transaction Controller), [`springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/in/kafka/KafkaTransactionListener.java`](https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/in/kafka/KafkaTransactionListener.java) (Kafka Consumer), [`springQueue/src/main/java/com/example/springqueue/application/usecases/ProcessTransactionUseCaseImpl.java`](https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/application/usecases/ProcessTransactionUseCaseImpl.java) (Process Use Case), [`springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/out/kafka/KafkaTransactionPublisher.java`](https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/out/kafka/KafkaTransactionPublisher.java) (Kafka Publisher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["REST API"]
  node_controller["Transaction Controller"]
  node_request["Request Validation"]
end

subgraph group_processing["Transaction Processing"]
  node_receive["Receive Use Case"]
  node_processor["Process Use Case"]
  node_idempotency[("Idempotency Store")]
  node_domain["Transaction Model"]
end

subgraph group_messaging["Kafka Messaging"]
  node_publisher["Kafka Publisher"]
  node_kafka["Kafka Topic"]
  node_listener["Kafka Consumer"]
  node_retrydlq["Retry and DLQ"]
end

subgraph group_observability["Observability"]
  node_correlation["Correlation ID"]
  node_zipkin["Zipkin Tracing"]
end

node_client(("HTTP Client"))

node_client -->|"submits request"| node_controller
node_controller -->|"validates input"| node_request
node_controller -->|"publishes event"| node_publisher
node_publisher -->|"sends event"| node_kafka
node_kafka -->|"delivers event"| node_listener
node_listener -->|"processes event"| node_processor
node_listener -->|"checks idempotency"| node_idempotency
node_listener -->|"retries or dead-letters"| node_retrydlq
node_controller -->|"logs correlation ID"| node_correlation
node_processor -.->|"traces processing"| node_zipkin

click node_controller "https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/in/web/controller/TransactionController.java"
click node_request "https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/in/web/dto/TransactionRequest.java"
click node_receive "https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/application/usecases/ReceiveTransactionUseCaseImpl.java"
click node_publisher "https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/out/kafka/KafkaTransactionPublisher.java"
click node_listener "https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/in/kafka/KafkaTransactionListener.java"
click node_processor "https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/application/usecases/ProcessTransactionUseCaseImpl.java"
click node_idempotency "https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/out/memory/InMemoryIdempotencyStore.java"
click node_retrydlq "https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/in/kafka/KafkaTransactionListener.java"
click node_domain "https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/domain/model/TransactionEvent.java"
click node_correlation "https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/in/web/filter/CorrelationIdFilter.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_controller,node_request,node_client toneBlue
class node_receive,node_processor,node_idempotency,node_domain toneAmber
class node_publisher,node_kafka,node_listener,node_retrydlq toneMint
class node_correlation,node_zipkin toneRose
```

## Components

### REST API

- [Transaction Controller](https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/in/web/controller/TransactionController.java): `springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/in/web/controller/TransactionController.java`
- [Request Validation](https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/in/web/dto/TransactionRequest.java): `springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/in/web/dto/TransactionRequest.java`

### Transaction Processing

- [Receive Use Case](https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/application/usecases/ReceiveTransactionUseCaseImpl.java): `springQueue/src/main/java/com/example/springqueue/application/usecases/ReceiveTransactionUseCaseImpl.java`
- [Process Use Case](https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/application/usecases/ProcessTransactionUseCaseImpl.java): `springQueue/src/main/java/com/example/springqueue/application/usecases/ProcessTransactionUseCaseImpl.java`
- [Idempotency Store](https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/out/memory/InMemoryIdempotencyStore.java): `springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/out/memory/InMemoryIdempotencyStore.java`
- [Transaction Model](https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/domain/model/TransactionEvent.java): `springQueue/src/main/java/com/example/springqueue/domain/model/TransactionEvent.java`

### Kafka Messaging

- [Kafka Publisher](https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/out/kafka/KafkaTransactionPublisher.java): `springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/out/kafka/KafkaTransactionPublisher.java`
- **Kafka Topic**
- [Kafka Consumer](https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/in/kafka/KafkaTransactionListener.java): `springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/in/kafka/KafkaTransactionListener.java`
- [Retry and DLQ](https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/in/kafka/KafkaTransactionListener.java): `springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/in/kafka/KafkaTransactionListener.java`

### Observability

- [Correlation ID](https://github.com/hericoelho/spring-kafka-docker/blob/main/springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/in/web/filter/CorrelationIdFilter.java): `springQueue/src/main/java/com/example/springqueue/infrastructure/adapter/in/web/filter/CorrelationIdFilter.java`
- **Zipkin Tracing**

### Other components

- **HTTP Client**

## Connections

- HTTP Client → Transaction Controller: submits request (evidence: `README.md`)
- Transaction Controller → Request Validation: validates input (evidence: `README.md`)
- Transaction Controller → Kafka Publisher: publishes event (evidence: `README.md`)
- Kafka Publisher → Kafka Topic: sends event (evidence: `README.md`)
- Kafka Topic → Kafka Consumer: delivers event (evidence: `README.md`)
- Kafka Consumer → Process Use Case: processes event (evidence: `README.md`)
- Kafka Consumer → Idempotency Store: checks idempotency (evidence: `README.md`)
- Kafka Consumer → Retry and DLQ: retries or dead-letters (evidence: `README.md`)
- Transaction Controller → Correlation ID: logs correlation ID (evidence: `README.md`)
- Process Use Case → Zipkin Tracing: traces processing (evidence: `README.md`)
