This service is a Spring Boot application built to handle high volumes of payment transactions. It’s designed to scale effortlessly within a Kubernetes cluster, allowing multiple nodes to process payment intents in parallel without stepping on each other’s toes. It uses PostgreSQL with FOR UPDATE SKIP LOCKED to safely fetch and lock batches of payment intents for processing. This approach ensures smooth operation and avoids conflicts when multiple nodes are working simultaneously. The app also uses Spring’s scheduling to process transactions in regular batches, making it fast and reliable for large-scale payment workflows. Monitoring can be set up with Prometheus to keep an eye on performance and system health.
- Batch Processing: Efficiently processes payment intents in configurable batch sizes.
- Concurrency Control: Ensures no duplicate processing using row-level locking with FOR UPDATE SKIP LOCKED.
- Scalability: Easily scales horizontally with multiple Kubernetes replicas.
- Resilience: Handles node crashes gracefully with retry mechanisms and timeout handling.
- Monitoring: Integrated Prometheus metrics for real-time monitoring and alerting.
- Dockerized: Containerized application for easy deployment and management.
You have to create k8s cluster
- Install Minikube:
brew install minikube
- Install kubectl:
brew install kubectl
- Start the cluster:
minikube start
git clone https://github.com/overpathz/distributed-job-processor.git
- Run other services (postgres + observability stack):
docker-compose up -d
- Intermediate step. Your local Docker daemon and the Docker daemon inside Minikube are separate. By default, images built on your local machine are not available inside Minikube’s environment.
So, execute this command in your project root:eval $(minikube -p minikube docker-env)
- Build app image:
docker build -t distributed-job-processor:0.0.1 .
- Deploy the application to Kubernetes:
kubectl apply -f deployment.yml
- kubectl delete deployment distributed-job-processor
- kubectl logs -f (it changes dynamically)
- docker build -t distributed-job-processor:0.0.1 . (dot is current context (Dockerfile))
- docker volume list
- docker volume rm db-data
- kubectl apply -f deployment.yml
- kubectl get pods