# java-techie-jt/kafka-producer-example architecture

> Architecture diagram of the GitHub repository java-techie-jt/kafka-producer-example, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/java-techie-jt/kafka-producer-example
- Repository: https://github.com/java-techie-jt/kafka-producer-example

## Overview

This is a small Spring Boot Kafka producer. HTTP clients submit either a string message or a Customer payload; EventController delegates publishing to KafkaMessagePublisher, which sends to Kafka topics through KafkaTemplate. KafkaProducerConfig supplies the producer settings, template, and a topic declaration. The README also documents operating Kafka locally, but not additional application workflows. Wiring beyond the sampled source is omitted.

Main entry points: [`src/main/java/com/javatechie/controller/EventController.java`](https://github.com/java-techie-jt/kafka-producer-example/blob/main/src/main/java/com/javatechie/controller/EventController.java) (Event controller), [`src/main/java/com/javatechie/config/KafkaProducerConfig.java`](https://github.com/java-techie-jt/kafka-producer-example/blob/main/src/main/java/com/javatechie/config/KafkaProducerConfig.java) (Kafka template), [`src/main/java/com/javatechie/service/KafkaMessagePublisher.java`](https://github.com/java-techie-jt/kafka-producer-example/blob/main/src/main/java/com/javatechie/service/KafkaMessagePublisher.java) (Kafka publisher), [`src/main/java/com/javatechie/dto/Customer.java`](https://github.com/java-techie-jt/kafka-producer-example/blob/main/src/main/java/com/javatechie/dto/Customer.java) (Customer payload)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_application["Spring Boot app"]
end

subgraph group_http["HTTP publishing"]
  node_controller["Event controller"]
  node_customer["Customer payload<br/>[Customer.java]"]
end

subgraph group_kafka["Kafka integration"]
  node_publisher["Kafka publisher"]
  node_config["Producer config"]
  node_template["Kafka template"]
  node_topic["Declared topic"]
end

node_client(("HTTP client"))
node_broker[("Kafka broker")]

node_application -->|"serves routes"| node_controller
node_client -->|"HTTP request"| node_controller
node_client -->|"submits JSON"| node_customer
node_controller -->|"delegates publish"| node_publisher
node_controller -->|"binds payload"| node_customer
node_publisher -->|"sends records"| node_template
node_config -->|"configures"| node_template
node_config -->|"declares topic"| node_topic
node_template -->|"publishes records"| node_broker
node_topic -->|"topic declaration"| node_broker

click node_application "https://github.com/java-techie-jt/kafka-producer-example/blob/main/src/main/java/com/javatechie/KafkaProducerExampleApplication.java"
click node_controller "https://github.com/java-techie-jt/kafka-producer-example/blob/main/src/main/java/com/javatechie/controller/EventController.java"
click node_customer "https://github.com/java-techie-jt/kafka-producer-example/blob/main/src/main/java/com/javatechie/dto/Customer.java"
click node_publisher "https://github.com/java-techie-jt/kafka-producer-example/blob/main/src/main/java/com/javatechie/service/KafkaMessagePublisher.java"
click node_config "https://github.com/java-techie-jt/kafka-producer-example/blob/main/src/main/java/com/javatechie/config/KafkaProducerConfig.java"
click node_template "https://github.com/java-techie-jt/kafka-producer-example/blob/main/src/main/java/com/javatechie/config/KafkaProducerConfig.java"
click node_topic "https://github.com/java-techie-jt/kafka-producer-example/blob/main/src/main/java/com/javatechie/config/KafkaProducerConfig.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_application,node_client toneBlue
class node_controller,node_customer,node_broker toneAmber
class node_publisher,node_config,node_template,node_topic toneMint
```

## Components

### Application entry

- [Spring Boot app](https://github.com/java-techie-jt/kafka-producer-example/blob/main/src/main/java/com/javatechie/KafkaProducerExampleApplication.java): `src/main/java/com/javatechie/KafkaProducerExampleApplication.java`

### HTTP publishing

- [Event controller](https://github.com/java-techie-jt/kafka-producer-example/blob/main/src/main/java/com/javatechie/controller/EventController.java): `src/main/java/com/javatechie/controller/EventController.java`
- [Customer payload](https://github.com/java-techie-jt/kafka-producer-example/blob/main/src/main/java/com/javatechie/dto/Customer.java): `src/main/java/com/javatechie/dto/Customer.java`

### Kafka integration

- [Kafka publisher](https://github.com/java-techie-jt/kafka-producer-example/blob/main/src/main/java/com/javatechie/service/KafkaMessagePublisher.java): `src/main/java/com/javatechie/service/KafkaMessagePublisher.java`
- [Producer config](https://github.com/java-techie-jt/kafka-producer-example/blob/main/src/main/java/com/javatechie/config/KafkaProducerConfig.java): `src/main/java/com/javatechie/config/KafkaProducerConfig.java`
- [Kafka template](https://github.com/java-techie-jt/kafka-producer-example/blob/main/src/main/java/com/javatechie/config/KafkaProducerConfig.java): `src/main/java/com/javatechie/config/KafkaProducerConfig.java`
- [Declared topic](https://github.com/java-techie-jt/kafka-producer-example/blob/main/src/main/java/com/javatechie/config/KafkaProducerConfig.java): `src/main/java/com/javatechie/config/KafkaProducerConfig.java`

### Other components

- **HTTP client**
- **Kafka broker**

## Connections

- Spring Boot app → Event controller: serves routes
- HTTP client → Event controller: HTTP request
- HTTP client → Customer payload: submits JSON
- Event controller → Kafka publisher: delegates publish
- Event controller → Customer payload: binds payload
- Kafka publisher → Kafka template: sends records
- Producer config → Kafka template: configures
- Producer config → Declared topic: declares topic
- Kafka template → Kafka broker: publishes records
- Declared topic → Kafka broker: topic declaration
