ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false"); ModelCamelContext context = new DefaultCamelContext(); context.addComponent("jms", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
@Override public void configure() throws Exception { getContext().addComponent("freemarker", new TemplatingComponent("templates/", getClass().getClassLoader())); frameURL = "frameselector"+Long.toHexString(Double.doubleToLongBits(Math.random())); from("sallyservlet:///"+frameURL) .process(prepareItems) .to("freemarker:frameselector.html"); }
@Override public void configure() throws Exception { getContext().addComponent("freemarker", new TemplatingComponent("templates/", getClass().getClassLoader())); // getContext().addComponent("freemarker", new FreemarkerComponent()); from("sallyservlet:///mhw/libs?matchOnUriPrefix=true") .process(new FileServeProcessor("libs", getClass().getClassLoader() )); from("sallyservlet:///mhw/mhwsettings") .bean(method(this, "getMathHubWorkers")) // .to("freemarker:file:///home/costea/workspace_sally4/sally4/mhw-sally-service/src/main/resources/templates/mhwsettings.html"); .to("freemarker:mhwsettings.html"); from("sallyservlet:///mhw/setmhw") .bean(method(this, "setMHW")) // .to("freemarker:file:///home/costea/workspace_sally4/sally4/mhw-sally-service/src/main/resources/templates/mhwset.html"); .to("freemarker:mhwset.html"); } }
@Override public void configure() throws Exception { getContext().addComponent("freemarker", new TemplatingComponent("templates/", getClass().getClassLoader())); // getContext().addComponent("freemarker", new FreemarkerComponent()); from("sallyservlet:///mhw/libs?matchOnUriPrefix=true") .process(new FileServeProcessor("libs", getClass().getClassLoader() )); from("sallyservlet:///mhw/mhwsettings") .process(new QueryParser()) .bean(method(this, "getMathHubWorkers")) // .to("freemarker:file:///home/costea/workspace_sally4/sally4/mhw-sally-service/src/main/resources/templates/mhwsettings.html"); .to("freemarker:mhwsettings.html"); from("sallyservlet:///mhw/setmhw") .process(new QueryParser()) .bean(method(this, "setMHW")) // .to("freemarker:file:///home/costea/workspace_sally4/sally4/mhw-sally-service/src/main/resources/templates/mhwset.html"); .to("freemarker:mhwset.html"); } }
@Before public void mockEndpoints() throws Exception { if (tracing) { context.setTracing(true); context.setStreamCaching(true); context.getProperties().put(Exchange.LOG_DEBUG_BODY_STREAMS, Boolean.TRUE.toString()); } context.removeComponent("petals"); context.addComponent("petals", new MockComponent()); for (final String from : routesToMock()) { RouteDefinition routeDef = context.getRouteDefinition(from); assertNotNull("You should set the routeId of one of the routes to '" + from + "' from mocking to work", routeDef); routeDef.adviceWith(context, new AdviceWithRouteBuilder() { @Override public void configure() throws Exception { replaceFromWith("direct:" + from); } }); } context.start(); }
@Override public void configure() throws Exception { getContext().addComponent("freemarker", new TemplatingComponent("templates/", getClass().getClassLoader())); //getContext().addComponent("freemarker", new FreemarkerComponent()); from("sallyservlet:///annotationeditor") .to("log:annotaitonservice") .process(new QueryParser()) .bean(method(this, "processRequest")) .to("freemarker:annotator.html"); //.to("freemarker:file:///home/costea/workspace_sally4/sally4/office-base/src/main/resources/templates/annotator.html"); from("sallyservlet:///annotationeditornav") .process(new QueryParser()) .bean(method(this, "navRequest")); }
@Override public void configure() throws Exception { // lets shutdown quicker getContext().getShutdownStrategy().setTimeout(10); // configure the kafka component to use the broker KafkaComponent kafka = new KafkaComponent(); // you can specify more brokers separated by comma kafka.setBrokers("localhost:9092"); // add component to CamelContext getContext().addComponent("kafka", kafka); // use a timer to trigger every 100 milli seconds and generate a random word // which is sent to kafka from("timer:foo?period=100") .bean(new WordBean()) .to("kafka:words") .to("log:words?groupInterval=1000"); } }
@Override public void configure() throws Exception { JaxbDataFormat jaxb = new JaxbDataFormat(); jaxb.setContextPath("camelinaction"); // TODO: due activemq bug we need to configure it here also ActiveMQComponent jms = new ActiveMQComponent(getContext()); jms.setBrokerURL("tcp://localhost:61616"); getContext().addComponent("jms", jms); from("direct:inventory") .log("Calling inventory service using JMS") .hystrix() // call the legacy system using JMS .to("jms:queue:inventory") // the returned data is in XML format so convert that to POJO using JAXB .unmarshal(jaxb) .onFallback() .log("Circuit breaker failed so using fallback response") // fallback and read inventory from classpath which is in XML format .transform().constant("resource:classpath:fallback-inventory.xml"); }
@Override public void configure() throws Exception { JaxbDataFormat jaxb = new JaxbDataFormat(); jaxb.setContextPath("camelinaction"); // TODO: due activemq bug we need to configure it here also ActiveMQComponent jms = new ActiveMQComponent(getContext()); jms.setBrokerURL("tcp://localhost:61616"); getContext().addComponent("jms", jms); from("direct:inventory") .log("Calling inventory service using JMS") .hystrix() // call the legacy system using JMS .to("jms:queue:inventory") // the returned data is in XML format so convert that to POJO using JAXB .unmarshal(jaxb) .onFallback() .log("Circuit breaker failed so using fallback response") // fallback and read inventory from classpath which is in XML format .transform().constant("resource:classpath:fallback-inventory.xml"); }