UTEC · Software Engineering 2 (TAIS)
TAIS Lab
Sales system built from microservices, MQTT messaging, Jenkins and a cluster simulated with Docker Swarm.
- Role
- Team development: REST APIs, Docker and Swarm cluster
- Year
- 2026
- Stack
- JavaSpring BootMySQLMQTTJenkinsDocker Swarm
The problem
Software architecture lab: support a shop that sells in person and also takes orders from the web. It was solved in stages, from two independent APIs up to a cluster, and every stage added an architecture decision that had to be justified.
What I built
- A products REST API, with catalog and stock, and an orders REST API that checks existence and stock when an order is placed and answers with a 409 when there isn't enough.
- A publisher service that sends orders ready to process to Mosquitto, and a processing service that receives them, deducts stock, generates the invoice and updates the status.
- One MySQL database per service, with no cross access to each other's tables.
- A Jenkins pipeline that copies a new version of the system and deploys it.
- A cluster simulated with Docker Swarm: three replicas of the orders service behind the routing mesh, with a header showing which instance served each request.
Technical decisions
The orders service doesn't know about the broker
Messaging is the sole responsibility of the publisher and the processor. That keeps orders a simple API that can restart or scale regardless of whether Mosquitto is up.
Idempotent processing
With QoS 1 a message can arrive twice. Each order is processed once thanks to its own record, and if the stock deduction fails halfway, what was already deducted is given back. The window that remains without distributed transactions is documented.
Swarm's routing mesh instead of Nginx
Spreading requests across the three replicas only needed the load balancing Swarm already ships, so we didn't add another component to maintain.
What I took away
- Splitting a system into services with their own database and connecting them over HTTP and messages.
- Thinking about failure: duplicates, services down and compensations, not just the happy path.
- Operating a many-container stack on Docker Swarm and checking load distribution from the logs.