February 2019
Intermediate to advanced
446 pages
10h 55m
English
The billing service also now produces a billing response and consumes a booking order event. We have added code for that. There is no saga code in the billing service, so the code is straightforward. We have just added a small trick to generate the failed billing message using a random generator, as follows:
@StreamListener(BillingMessageChannels.BOOKING_ORDER_INPUT) public void consumeBookingOrder(BookingOrder bookingOrder) { LOG.info("Received BookingOrder: {}", bookingOrder); // TODO: Add logic if booking order is already processed or in process long randomId = RANDOM.nextLong(); if (randomId < 0) { LOG.info("\n\n\nGenerate failed billing event for negative randomId for testing\n\n\n"); billingEventHandler.produceBillingEvent(null, ...Read now
Unlock full access