This project has some modules to represent
microservices and the communication between then using kafka.
- commons-database: Commons code to access database;
- commons-kafka: Commons code to create
consumers
andproducers
; - email: Listen topic
store.new-order
andstore.send-email
; - log: Log all messages sended to
store.*
; - order: Listen topic
store.new-order
and save it in the database; - report: Listen topic
store.create-report-for-user
and create a report for each user; - user:
- Listen topic
store.new-order
and create a user, if it does not exists; - Listen topic
store.send-message-to-all-users
to send a command tostore.create-report-for-user
;
- Listen topic
- producer: Create the first input which will be send to
store.new-order
, it would be something like an http endpoint that create an order.
- First you need to start a
kafka
server in your local machine, which has to be located inlocalhost:9092
as you can see inKafkaReceiver.java
; - Run the
Main
class in each module to create consumers and producers needed; - Run the
MainProducer.java
to create first messages instore.new-order
.
- Ignore the strategy used to simulate a local database and deal with
Exceptions
, the objective is try kafka and not protect yourself with sql injection and other defensive strategies. - This project were created following the online trainning
- https://www.alura.com.br/curso-online-kafka-introducao-a-streams-em-microservicos
- https://www.alura.com.br/curso-online-kafka-cluster-de-microservicos
- https://www.alura.com.br/curso-online-kafka-batches-correlation-ids-e-dead-letters
- https://www.alura.com.br/curso-online-kafka-idempotencia-e-garantias