org.apache.camel.main.Main类的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中org.apache.camel.main.Main类的一些代码示例,展示了Main类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Main类的具体详情如下:
包路径:org.apache.camel.main.Main
类名称:Main

Main介绍

暂无

代码示例

代码示例来源:origin: camelinaction/camelinaction2

public static void main(String[] args) throws Exception {
    Main main = new Main();
    main.addRouteBuilder(new MetricsRouteBuilder());
    main.enableHangupSupport();
    main.run();
  }
}

代码示例来源:origin: codice/ddf

public static void main(String... args) throws Exception {
 // normally this would run inside of some container and be converted to a camel blueprint.xml
 // but to simplify testing of a route we can use the dsl camel language and run it from a camel
 // main
 Main main = new Main();
 main.addRouteBuilder(new OpenwireProducerConsumerExample());
 main.run(args);
}

代码示例来源:origin: org.apache.uima/uima-ducc-common

String methodName = "boot";
camelMain = new Main();
camelMain.enableHangupSupport();
camelMain.start();

代码示例来源:origin: org.apache.camel/camel-spring-boot

/**
 * Runs the application and blocks the main thread and shutdown Camel graceful when the JVM is stopping.
 */
public void run() {
  LOG.debug("Controller is starting and waiting for Spring-Boot to stop or JVM to terminate");
  try {
    main.run();
    // keep the daemon thread running
    LOG.debug("Waiting for CamelContext to complete shutdown");
    latch.await();
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
  LOG.debug("CamelContext shutdown complete.");
}

代码示例来源:origin: camelinaction/camelinaction2

/**
 * A main() so we can easily run these routing rules in our IDE
 */
public static void main(String... args) throws Exception {
  Main main = new Main();
  main.addRouteBuilder(new MyRouteBuilder());
  main.run(args);
}

代码示例来源:origin: camelinaction/camelinaction2

public static void main(String[] args) throws Exception {
  Main main = new Main();
  // enable remote JMX management connector
  main.addMainListener(new MainListenerSupport() {
    @Override
    public void configure(CamelContext context) {
      context.getManagementStrategy().getManagementAgent().setCreateConnector(true);
    }
  });
  // add a little route
  main.addRouteBuilder(new RouteBuilder() {
    @Override
    public void configure() throws Exception {
      from("timer:foo?period=1000").log("I am running");
    }
  });
  // allow to stop nicely when jvm terminates
  main.enableHangupSupport();
  // keep running
  main.run();
}

代码示例来源:origin: camelinaction/camelinaction2

public static void main(String[] args) throws Exception {
  Main main = new Main();
  main.addRouteBuilder(new MyStaticRouteGlobal());
  main.run();
}

代码示例来源:origin: camelinaction/camelinaction2

public static void main(String[] args) throws Exception {
  // use Camel main to run Camel easily from Java main
  Main main = new Main();
  // enable support for graceful shutdown if the JVM terminates
  main.enableHangupSupport();
  // add the route
  main.addRouteBuilder(new JolokiaRoute());
  System.out.println("Jolokia running. Try sending a HTTP GET to http://localhost:8778/jolokia/");
  System.out.println("Camel started use ctrl + c to stop.");
  // run until the JVM terminates
  main.run();
}

代码示例来源:origin: camelinaction/camelinaction2

public static void main(String[] args) throws Exception {
  Main main = new Main();
  main.addRouteBuilder(new MyStaticRouteEmbedded());
  main.run();
}

代码示例来源:origin: camelinaction/camelinaction2

public static void main(String[] args) throws Exception {
  // use Camel main to run Camel easily from Java main
  Main main = new Main();
  // enable support for graceful shutdown if the JVM terminates
  main.enableHangupSupport();
  // add the route
  main.addRouteBuilder(new PingService());
  System.out.println("Ping service running. Try sending a HTTP GET to http://localhost:8080/ping");
  System.out.println("Camel started use ctrl + c to stop.");
  // run until the JVM terminates
  main.run();
}

代码示例来源:origin: org.apache.camel/camel-example-ftp

public static void main(String[] args) throws Exception {
  Main main = new Main();
  main.addRouteBuilder(new MyFtpServerRouteBuilder());
  main.run();
}

代码示例来源:origin: camelinaction/camelinaction2

public static void main(String[] args) throws Exception {
    Main main = new Main();

    // bind the bean to the Camel registry using the name hello
    main.bind("hello", new HelloBean());

    // add the route
    main.addRouteBuilder(new HelloRoute());

    // run the application
    main.run();
  }
}

代码示例来源:origin: camelinaction/camelinaction2

public static void main(String[] args) throws Exception {
    Main main = new Main();
    main.addRouteBuilder(new WordRoute());
    main.run();
  }
}

代码示例来源:origin: camelinaction/camelinaction2

public void boot() throws Exception {
  // create and embed the hazelcast server
  // (you can use the hazelcast client if you want to connect to external hazelcast server)
  HazelcastInstance hz = Hazelcast.newHazelcastInstance();
  // setup the hazelcast idempotent repository which we will use in the route
  HazelcastIdempotentRepository repo = new HazelcastIdempotentRepository(hz, "camel");
  main = new Main();
  // bind the hazelcast repository to the name myRepo which we refer to from the route
  main.bind("myRepo", repo);
  // add the route and and let the route be named BAR and use a little delay when processing the files
  main.addRouteBuilder(new FileConsumerRoute("BAR", 100));
  main.run();
}

代码示例来源:origin: camelinaction/camelinaction2

public static void main(String[] args) throws Exception {
  // use org.apache.camel.main.Main to make it easier to run Camel standalone
  Main main = new Main();
  // add the routes
  main.addRouteBuilder(new HelloRoute());
  // run the application (keep it running)
  main.run();
}

代码示例来源:origin: camelinaction/camelinaction2

public void boot() throws Exception {
  // create and embed the hazelcast server
  // (you can use the hazelcast client if you want to connect to external hazelcast server)
  HazelcastInstance hz = Hazelcast.newHazelcastInstance();
  // setup the hazelcast idempotent repository which we will use in the route
  HazelcastIdempotentRepository repo = new HazelcastIdempotentRepository(hz, "camel");
  main = new Main();
  // bind the hazelcast repository to the name myRepo which we refer to from the route
  main.bind("myRepo", repo);
  // add the route and and let the route be named BAR and use a little delay when processing the files
  main.addRouteBuilder(new FileConsumerRoute("FOO", 100));
  main.run();
}

代码示例来源:origin: camelinaction/camelinaction2

/**
 * A main() so we can easily run these routing rules in our IDE
 */
public static void main(String... args) throws Exception {
  Main main = new Main();
  main.addRouteBuilder(new MyRouteBuilder());
  main.run(args);
}

代码示例来源:origin: camelinaction/camelinaction2

public static void main(String[] args) throws Exception {
  Main main = new Main();
  main.bind("orderService", new OrderService());
  main.bind("tokenService", new TokenService());
  main.addRouteBuilder(new OrderRoute());
  System.out.println("=======================================================");
  System.out.println("Starting HTTP server on port 8080");
  System.out.println("Hit url http://localhost:8080/service/order/123");
  System.out.println("... and press CTRL + C to exit");
  System.out.println("=======================================================");
  main.run();
}

代码示例来源:origin: org.apache.camel/camel-example-ftp

public static void main(String[] args) throws Exception {
  Main main = new Main();
  main.addRouteBuilder(new MyFtpClientRouteBuilder());
  main.run();
}

代码示例来源:origin: camelinaction/camelinaction2

public void boot(String[] args) throws Exception {
  // create and embed the hazelcast server
  // (you can use the hazelcast client if you want to connect to external hazelcast server)
  HazelcastInstance hz = Hazelcast.newHazelcastInstance();
  main = new Main();
  main.bind("hz", hz);
  if (args.length == 0) {
    // route which uses get/put operations
    main.addRouteBuilder(new CounterRoute("Foo", 8080));
  } else {
    // route which uses atomic counter
    main.addRouteBuilder(new AtomicCounterRoute("Foo", 8080));
  }
  main.run();
}

相关文章