Giter VIP home page Giter VIP logo

distributed-transactions-kafka's Introduction

Distributed Transactions in Microservices with Kafka Streams and Spring Boot

Run application

  • Use docker to deploy kafka with registry (Use reference project to download docker compose yml file).
docker compose -f zk-single-kafka-multiple-schema-registry-ui.yml up -d

Open UI for Apache Kafka at http://localhost:8084/.

  • Run gradle build to generate avro source files
cd common-lib
gradle clean build
  • Run application

    • order-service
    cd order-service
    gradle clean bootRun
    • payment-service
    cd payment-service
    gradle clean bootRun
    • stock-service
    cd stock-service
    gradle clean bootRun
  • Use following request to generate orders

curl --location --request POST 'http://localhost:8080/orders/generate'
  • Use following request to check orders status
curl --location --request GET 'http://localhost:8080/orders'

Stop application

  • Use ctrl+c to cancel running applications
  • Use following command to stop and remove kafka containers
docker compose -f zk-single-kafka-multiple-schema-registry-ui.yml down

Kubernetes Deployment

  • Start kafka
helm repo add confluentinc https://confluentinc.github.io/cp-helm-charts/
helm repo update
helm install my-kafka -f ./k8s/kafka/values.yaml confluentinc/cp-helm-charts
  • Application Deployment
gradle clean dockerTag
kubectl apply -f ./k8s/app
  • Use following request to generate orders
curl --location --request POST 'http://localhost:30001/orders/generate'
  • Use following request to check orders status
curl --location --request GET 'http://localhost:30001/orders'
  • Clean up
kubectl delete -f ./k8s/app
helm delete my-kafka
  • Expose Confluent Control Center via NodePort
kubectl patch svc my-kafka-cp-control-center --type='json' -p '[{"op":"replace","path":"/spec/type","value":"NodePort"}]'

Reference

distributed-transactions-kafka's People

Contributors

ashutoshsahoo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.