Spring Boot microservice that ingests transaction events from Kafka and serves real-time balances on a lightweight REST endpoint. One deployable handles streaming updates and read requests on a fixed port for operational simplicity.

Users needed a trustworthy way to check balances inside Midas, but the core service only ingested transactions. Spinning up a dedicated read surface would add another deployable and operational overhead for what amounts to a single endpoint.
Extend Midas Core to answer read requests alongside its Kafka consumer. A new Spring MVC controller exposes GET /balance and reuses the same transactional model used by the consumer.
GET /balance?userId=... on port 33400.Balance DTO with the latest amount.Balance objectThe balances table is keyed by user ID with a decimal amount column. Kafka-driven writes are the source of truth, while reads stay pure by issuing a single repository call per request.
A separate read service would be clean but slower to ship and support. Folding the endpoint into Core keeps the surface area minimal while retaining a clear path to extract later.
The database remains the canonical source—Kafka listeners derive balances deterministically, so the REST layer stays stateless and safe.
One build, one deployment target, one health check. Less to monitor for an intentionally small feature.
Balance DTO.Balancing separation of concerns with delivery speed led to layering a read controller inside Core. The code stays modular so the controller can be extracted once traffic justifies it.
Keeping the database as the source of truth avoids drift between streaming ingest and reads. The controller never mutates data, it only projects the latest balance.
Fewer deployables mean less monitoring, fewer secrets, and simpler on-call playbooks—ideal for a feature that started as a small experiment.
Balance DTO on /balance.