In a microservice architecture a business process often crosses the boundaries
of a single service. What used to be a method call in a monolithic application
becomes network communication, which raises questions of reliability and
data consistency. This thesis presents a car sharing system built with the
Quarkus framework and the NATS JetStream messaging system, in which
a booking changes the state of a vehicle owned by another service. The
services are data autonomous and communicate both synchronously over
REST interfaces and asynchronously through events. We tested the system’s
behaviour while the consuming service was down. The experiment showed
that all messages were processed after the restart, but not in the order in
which they had been published, leaving the vehicle in an incorrect state. We
found that a consumer setting an absolute target state tolerates duplicate
delivery but is not independent of ordering. We addressed this by recording
the booking lifecycle stage reached so far, on the basis of which a consumer
rejects a premature event and leaves it to redelivery. After the fix the system
converges to the correct state even under the least favourable processing
order.
|