use of org.apache.karaf.examples.scr.api.Booking in project karaf by apache.
the class ConsoleClient method start.
@Activate
public void start() throws Exception {
Booking booking = new Booking();
booking.setId(1L);
booking.setFlight("AF520");
booking.setCustomer("John Doe");
bookingService.add(booking);
booking = new Booking();
booking.setId(2L);
booking.setFlight("AF59");
booking.setCustomer("Alan Parker");
bookingService.add(booking);
running = true;
Thread thread = new Thread(() -> {
while (running) {
try {
Thread.sleep(5000);
for (Booking booking1 : bookingService.list()) {
System.out.println();
System.out.println("-----------");
System.out.println(booking1.getId() + " - " + booking1.getFlight() + " - " + booking1.getCustomer());
}
} catch (Exception e) {
// nothing to do
}
}
});
thread.start();
}