public TenantInfo getTenantInfo(String tenantId) throws Exception {
   // JdbcTemplate jdbc = new JdbcTemplate(dataSource);
   String sql = "select * from tenant where tenant_guid='" + tenantId + "'";
   TenantInfo info = null;
   try {
     Class.forName("com.mysql.jdbc.Driver");
     // Setup the connection with the DB
     connection =
         DriverManager.getConnection(
             "jdbc:mysql://"
                 + dataSource.getHOST()
                 + ":"
                 + dataSource.getPORT()
                 + "/"
                 + dataSource.getDATABASE()
                 + "?"
                 + "user="******"&password="******"tenant_guid"));
       info.setOutboundType(resultSet.getInt("outbound_end_point_type") + "");
       info.setOutboundUrl(resultSet.getString("outbound_url"));
       System.out.println(
           "tenant found, outbound type:"
               + info.getOutboundType()
               + ",url:"
               + info.getOutboundUrl());
     }
   } catch (Exception e) {
     e.printStackTrace();
     String mesg = "InRoomDiningProcessor: getTenantInfo " + e.toString();
     if (1
         == new SendEmail()
             .sendEmail(
                 emailSource.getHOST(),
                 emailSource.getFROM_EMAIL(),
                 emailSource.getADMIN_EMAIL(),
                 emailSource.getPASS(),
                 emailSource.getPORT(),
                 null,
                 "Database Failure at InRoomDiningProcessor",
                 mesg,
                 emailSource.getFROM_NAME())) {
       // exchange.getOut().setBody("<Message><Failure>An exception has occured. An email is sent
       // to Admin.</Failure></Message>");
     } else {
       // exchange.getOut().setBody("<Message><Failure>An exception has occured. Email sending to
       // Admin failed too.</Failure></Message>");
     }
   }
   return info;
 }
 public InRoomOrderPayLoad populateTenantInfo(Exchange exchange) {
   try {
     System.out.println("HEREE");
     String value = exchange.getIn().getBody().toString();
     String tenantId = XMLElementExtractor.extractXmlElementValue(value, "tenantId");
     if (tenantId == null) tenantId = "test_guid";
     System.out.println("PopulateTenantInfo xml \n" + value + "\ntenantId:" + tenantId);
     TenantInfo tenant = getTenantInfo(tenantId);
     if (tenant == null) {
       tenant = new TenantInfo();
       tenant.setOutboundType("404");
     }
     InRoomOrderPayLoad payload = new InRoomOrderPayLoad(value, tenant);
     return payload;
   } catch (Exception e) {
     String mesg = "InRoomDiningProcessor: populateTenantInfo " + e.toString();
     if (1
         == new SendEmail()
             .sendEmail(
                 emailSource.getHOST(),
                 emailSource.getFROM_EMAIL(),
                 emailSource.getADMIN_EMAIL(),
                 emailSource.getPASS(),
                 emailSource.getPORT(),
                 null,
                 "Exception occured at InRoomDiningProcessor",
                 mesg,
                 emailSource.getFROM_NAME())) {
       exchange
           .getOut()
           .setBody(
               "<Message><Failure>An exception has occured. An email is sent to Admin.</Failure></Message>");
     } else {
       exchange
           .getOut()
           .setBody(
               "<Message><Failure>An exception has occured. Email sending to Admin failed too.</Failure></Message>");
     }
     exchange.getOut().setBody(e.toString());
   }
   return null;
 }