projectsystemsdataweb
Photo Scale Microservice
Event-driven image-scaling microservice.- Java
- Vert.x
- Kafka
- AWS S3
A microservice from SagasLife, our university distributed-systems project — the part responsible for scaling photos to different resolutions by width.
It listens on two Kafka topics, one for userpics and one for ordinary photos, and the topic
doubles as the routing key: it decides which AWS S3 bucket the original lives in. A message is
just a prefix and a file name. put:pretty_woman.jpg fetches the original from S3, scales it
to the sizes defined in the config, and writes the results back with suffixes —
pretty_woman.jpg.sm, .md, .lg for small, medium and large. del:pretty_woman.jpg
removes those same scaled files. Either way, the operation status is reported to the Sagas
coordinator over its own topic.
Everything variable lives in one config.json — the scale sizes, bucket names and region,
image extension, Kafka host and topic names, and even the put:/del: prefixes themselves —
so behaviour changes without touching the code. The service ships with unit tests, integration
tests against Kafka, and a Docker setup for running it all.