/** * Program entry point */ public static void main(String[] args) throws Exception { CamelContext context = new DefaultCamelContext(); context.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from("stream:in").to("direct:greetings"); from("direct:greetings").to("stream:out"); } }); context.start(); context.getRoutes().forEach(r -> LOGGER.info(r.toString())); context.stop(); } }
@Override public void start() throws Exception { vertx.eventBus().consumer("announce", message -> { System.out.println("ANNOUNCE >> " + message.body()); }); vertx.eventBus().consumer("errors", message -> { System.out.println("ERROR >> " + message.body()); }); SimpleRegistry registry = new SimpleRegistry(); registry.put("filterService", new ReleasePostFilter()); CamelContext camelContext = new DefaultCamelContext(registry); camelContext.addRoutes(createMyRoutes()); camelContext.start(); CamelBridge.create(vertx, new CamelBridgeOptions(camelContext) .addInboundMapping(fromCamel("seda:announce").toVertx("announce")) .addInboundMapping(fromCamel("seda:errors").toVertx("errors"))) .start(); }
/** * A helper method to create a list of Route objects for a given route builder */ public static List<Route> getRouteList(RouteBuilder builder) throws Exception { CamelContext context = new DefaultCamelContext(); context.addRoutes(builder); context.start(); List<Route> answer = context.getRoutes(); context.stop(); return answer; }
/** * A helper method to create a list of Route objects for a given route builder */ public static List<Route> getRouteList(RouteBuilder builder) throws Exception { CamelContext context = new DefaultCamelContext(); context.addRoutes(builder); context.start(); List<Route> answer = context.getRoutes(); context.stop(); return answer; }
/** * Add a route. * * @param builder the route to add. */ public void addRoutes(final RouteBuilder builder) throws Exception { this.logger.debug("Adding a route to the context"); this.camel.addRoutes(builder); }
@Override protected synchronized void startConsumingForModule(SinkModule<?, Message> module) throws Exception { if (!routeIdsByModule.containsKey(module)) { LOG.info("Creating route for module: {}", module); final DynamicIpcRouteBuilder routeBuilder = new DynamicIpcRouteBuilder(context, this, module); context.addRoutes(routeBuilder); routeIdsByModule.put(module, routeBuilder.getRouteId()); } }
public static void main(String[] args) throws Exception { CamelContext context = new DefaultCamelContext(); context.addRoutes(new PingService()); context.start(); 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."); Runtime.getRuntime().addShutdownHook(new ShutdownThread(context)); Thread.sleep(99999999); }
public static void main(String[] args) throws Exception { CamelContext context = new DefaultCamelContext(); context.addRoutes(new HelloRoute()); context.start(); // keep the JVM running (a bit of a hack) Thread.sleep(Integer.MAX_VALUE); }
@Override public void configure(CustomRouteBuilder configuration) throws Exception{ if (configuration.getIntercepted() != null) { configuration.getIntercepted().includeRoutes(configuration); } else { camelContext.addRoutes(configuration); } LOG.debug("Custom route builder configured: {}", configuration); }
private void start() throws Exception { CamelContext camel = new DefaultCamelContext(); camel.addRoutes(new UseCaseRoute()); camel.start(); } }
public static void main(String[] args) throws Exception { CamelContext context = new DefaultCamelContext(); Main main = new Main(); context.addRoutes(main); context.start(); //for (int i=0; i<cases; ++i) { // context.createProducerTemplate().sendBody("direct:b", "b"+i); //} } }
private void start() throws Exception { CamelContext camel = new DefaultCamelContext(); camel.addRoutes(new UseCaseRoute()); camel.start(); } }
public static void main(String[] args) throws Exception { CamelContext context = new DefaultCamelContext(); Main main = new Main(); context.addRoutes(main); context.start(); //for (int i=0; i<cases; ++i) { // context.createProducerTemplate().sendBody("direct:b", "b"+i); //} } }
@Validate void start() throws Exception { CamelContext camel = new DefaultCamelContext(); camel.addComponent("sallyservlet", servlet.getCamelComponent()); camel.addRoutes(this); camel.start(); }
private void start() throws Exception { CamelContext camel = new DefaultCamelContext(); // add our custom component camel.addComponent("erp", new ERPComponent()); // add the route camel.addRoutes(new ERPRoute()); // and start Camel camel.start(); }
@Override public synchronized void addRouteForEndpoint(String startingEndpoint,URI brokerUri) throws CamelConfigurationFailedException { if (getCamelContext().getRoute(startingEndpoint)==null){ try { getCamelContext().addRoutes(createRoutesBuilder(startingEndpoint, brokerUri)); } catch (Exception e) { throw new CamelConfigurationFailedException("adding route to camel context failed",e); } } }
@Validate public void start() throws Exception{ clientManager = new ClientManagerModel(factory); camelContext = new DefaultCamelContext(); camelContext.addComponent("activemq", activeMQ.getDefaultActiveMQConnection()); camelContext.addComponent("freemarker", new TemplatingComponent("templates/", getClass().getClassLoader())); camelContext.addComponent("sallyservlet", servlet.getCamelComponent()); camelContext.addRoutes(this); camelContext.start(); }
@Validate void doStart() throws Exception { environmentid = theoClient.getEnvironmentID(); context = new DefaultCamelContext(); context.addComponent("sallyservlet", sallyServlet.getCamelComponent()); context.addRoutes(this); context.start(); }
public void run() throws Exception { CamelContext context = new DefaultCamelContext(); JmsConfiguration jmsConfig = new JmsConfiguration(new ActiveMQConnectionFactory("tcp://localhost:61616")); context.addComponent("jms", new JmsComponent(jmsConfig )); context.setTracing(true); context.addRoutes(new Jms2RestRoute()); context.start(); System.in.read(); context.stop(); }
@Validate public void start() throws Exception { camelContext = new DefaultCamelContext(); camelContext.addComponent("activemq", activeMQ.getDefaultActiveMQConnection()); camelContext.addRoutes(this); camelContext.getShutdownStrategy().setTimeout(10); camelContext.getShutdownStrategy().setSuppressLoggingOnTimeout(true); camelContext.start(); camelContext.createProducerTemplate().asyncSendBody("direct:startTimer", ""); init(); }