Both apps are producers and consumers at the same time, but for the purposes of the demo, producer side contract testing is set up for barista
module and consumer-side contract testing is set up for waiter
module.
- Trigger new order via HTTP call in Waiter app (
@PostMapping("/order/{name}/{count}"
), eg.http POST :8081/order/espresso/1
KafkaTemplate
is used to place a newOrder
onorders
topic- The Barista app listens on
orders
; when a new order appears, it processes it into aServing
and sends it toservings
topic; if the beverage name is not matched, aCoffeeNotAvailableException
is thrown and sent toerrors
topic - The Waiter app listens on
servings
anderrors
and logs information based on messages received on these topics