Spring Application Services

Exercise: Booking Application




  1. Create a Postgres database booking
  2. Implement a transactional travel service that allows customers to make travel bookings consisting of a flight and a hotel booking
    • Flights and hotels are booked separately by the booking service
    • If one booking fails, the whole travel booking is canceled
    • The booking attempt and possible failures are logged using the logging service e.g.
      Booking travel to London for Bob and Error: Hotels in London booked out
  3. Run the TravelIT integration test to test the service
  4. Set the following logging levels to observe the transaction management to DEBUG
  5. logging.level.org.springframework.transaction.interceptor.TransactionInterceptor
    logging.level.org.springframework.orm.jpa.JpaTransactionManager
    
  6. Implement an asynchronous travel service that allows customers to book travels by sending a message (e.g. London:Bob) to a booking queue
  7. Run the AsyncTravelIT integration test to test the service
  8. Observe the different behavior depending on whether the listener method is transactional or not

Template
Solution