Examples of WaiterMonitor


Examples of org.springframework.integration.samples.cafe.WaiterMonitor

  public static void main(String[] args)  {
  
    AbstractApplicationContext context =
      new ClassPathXmlApplicationContext("/META-INF/spring/integration/cafeDemo-control-bus.xml");
   
      WaiterMonitor waiterMonitor = (WaiterMonitor) context.getBean("waiterMonitor");
      
      int totalDeliveries = 0;
      while (totalDeliveries <= 3) {
        try {
          Thread.sleep(1000);
        }
        catch (InterruptedException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
       
        totalDeliveries = (Integer)waiterMonitor.sendControlScript("waiter.totalDeliveries");
       
        logger.info("Total cafe deliveries: " + totalDeliveries);
       
        if (totalDeliveries > 3) {
          logger.info("stopping orders...");
          waiterMonitor.sendControlScript("cafe.stop()");
          logger.info("orders stopped");
        }
      }
      context.close();
      System.exit(0);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.