@Override public void configure() throws Exception { JacksonDataFormat jackson = new JacksonDataFormat(); String result_queue = "latexmlresults_"+UUID.randomUUID().toString(); from("activemq:queue:"+result_queue) .unmarshal(jackson) .bean(method(this, "compile_result")); from("direct:compileLaTeXML") .setHeader("uid", constant(uid)) .setHeader("JMSReplyTo", constant(result_queue)) .to("activemq:queue:latexml?preserveMessageQos=true"); }
@Override public void configure() throws Exception { // HTTP service fromF("jetty:http://localhost:" + port) // increase the atomic clustered counter from the hazelcast cache .setHeader(HazelcastConstants.OBJECT_ID, constant("myCounter")) .to("hazelcast:atomicvalue:Cache?hazelcastInstance=#hz&defaultOperation=increment") // prepare http response .log(name + ": counter is now ${body}") .setHeader(Exchange.CONTENT_TYPE, constant("text/plain")) .transform().simple("Atomic Counter is now ${body}\n"); }
@Override public void configure() { from("stream:in") .setHeader("subject", new ConstantExpression("Hello, Jedi!")) .bean(obiWanBean, "exitCheck") .to("smtps://smtp.gmail.com:465" + "?username=" + address + "&password=" + password + "&to=" + to); } });
@Override public void configure() throws Exception { from("jms:queue:factory." + factoryType + ".inbound").routeId(factoryType + "_factory") .setHeader("name", xpath("order/type/text()")) .setHeader("id", xpath("order/id/text()")) .setHeader("amount", xpath("order/amount/text()")) .delay(constant(factoryCosts)) .setHeader(Exchange.HTTP_METHOD, constant("PUT")) .setBody(constant("")) .to("http://" + reportServerHost + ":" + reportServerPort + "/report/services/reporting"); } }
@Override public void configure() throws Exception { from("jms:queue:factory." + factoryType + ".inbound").routeId(factoryType + "_factory") .setHeader("name", xpath("order/type/text()")) .setHeader("id", xpath("order/id/text()")) .setHeader("amount", xpath("order/amount/text()")) .delay(constant(factoryCosts)) .setHeader(Exchange.HTTP_METHOD, constant("PUT")) .setBody(constant("")) .to("http://" + reportServerHost + ":" + reportServerPort + "/report/services/reporting"); } }
protected void errorHandler() { from("direct:error_" + messageBusDestination) .process(new ErrorProcessor()) .setHeader("responseId", property("correlationId")) .to("liferay:" + DestinationNames.MESSAGE_BUS_DEFAULT_RESPONSE); }
@Override public void configure() throws Exception { from("liferay:" + messageBusDestination) .errorHandler(deadLetterChannel("direct:error_" + messageBusDestination)) .setHeader(Exchange.HTTP_METHOD, simple(restMethod)) .setHeader(Exchange.ACCEPT_CONTENT_TYPE, simple(restContentType)) .setProperty("correlationId", header("responseId")) .inOut("cxfrs://" + restDestination) .process(new Processor() { @Override public void process(Exchange exchange) throws Exception { String result = extractResponseBody(exchange); exchange.getOut().setBody(result); } }) .setHeader("responseId", property("correlationId")) .to("liferay:" + DestinationNames.MESSAGE_BUS_DEFAULT_RESPONSE); errorHandler(); }
protected void errorHandler() { from("direct:error_" + messageBusDestination) .process(new ErrorProcessor()) .setHeader("responseId", property("correlationId")) .to("liferay:" + DestinationNames.MESSAGE_BUS_DEFAULT_RESPONSE); }
public void configure() throws Exception { from("file:src/data?noop=true") .convertBodyTo(PersonDocument.class) .to("jpa:org.apache.camel.example.etl.CustomerEntity"); // the following will dump the database to files from("jpa:org.apache.camel.example.etl.CustomerEntity?consumer.initialDelay=3000&delay=3000&consumeDelete=false&consumeLockEntity=false") .setHeader(Exchange.FILE_NAME, el("${in.body.userName}.xml")) .to("file:target/customers"); } }
public void configure() throws Exception { from("direct:a") .setHeader("uid", constant(1)) .inOut("activemq:queue:testqueue") .to("log:result_a"); from("direct:b") .setHeader("uid", constant(2)) .to("activemq:queue:testqueue") .to("log:result_b"); from("activemq:queue:testqueue") /* .process(setPriorities) .resequence(header("prio")) .batch().timeout(4000).size(100).allowDuplicates() .process(resetPriorities)*/ .bean(method(this, "reply")); };
public void configure() throws Exception { from("direct:a") .setHeader("uid", constant(1)) .inOut("activemq:queue:testqueue") .to("log:result_a"); from("direct:b") .setHeader("uid", constant(2)) .to("activemq:queue:testqueue") .to("log:result_b"); from("activemq:queue:testqueue") /* .process(setPriorities) .resequence(header("prio")) .batch().timeout(4000).size(100).allowDuplicates() .process(resetPriorities)*/ .bean(method(this, "reply")); };
@Override public void configure() throws Exception { from("liferay:" + messageBusDestination) .errorHandler(deadLetterChannel("direct:error_" + messageBusDestination)) .setProperty("correlationId", header("responseId")) .bean(beanType, methodCall) .setHeader("responseId", property("correlationId")) .to("liferay:" + DestinationNames.MESSAGE_BUS_DEFAULT_RESPONSE); from("direct:error_" + messageBusDestination) .process(new ErrorProcessor()) .setHeader("responseId", property("correlationId")) .to("liferay:" + DestinationNames.MESSAGE_BUS_DEFAULT_RESPONSE); } }
@Override public void configure() throws Exception { from("liferay:" + messageBusDestination) .errorHandler(deadLetterChannel("direct:error_" + messageBusDestination)) .setProperty("correlationId", header("responseId")) .beanRef(beanRef, methodCall) .setHeader("responseId", property("correlationId")) .to("liferay:" + DestinationNames.MESSAGE_BUS_DEFAULT_RESPONSE); from("direct:error_" + messageBusDestination) .process(new ErrorProcessor()) .setHeader("responseId", property("correlationId")) .to("liferay:" + DestinationNames.MESSAGE_BUS_DEFAULT_RESPONSE); } }
@Override public void configure() throws Exception { //NOSONAR // Initialize the global output producers addInterimProc(from(endpoints.getProducerUri()).setHeader(PLUGIN_ID, constant(pluginId)). log(DEBUG, format("===> ROUTE %s ===> %s", endpoints.getProducerUri(), endpoints.getOutputUri()))). to(endpoints.getOutputUri()). routeId(endpoints.getProducerRouteId()); // Initialize the global input producers addInterimProc(from(endpoints.getConsumerUri()). log(DEBUG, format("===> ROUTE %s ===> %s", endpoints.getConsumerUri(), endpoints.getInputUri())). setHeader(PLUGIN_ID, constant(pluginId))). to(endpoints.getInputUri()). routeId(endpoints.getConsumerRouteId()); // Initialize client notify topic addInterimProc(from(endpoints.getFrontendSendUri()).setHeader(PLUGIN_ID, constant(pluginId)). log(DEBUG, format("CLIENT NOTIFY FOR %s TO %s", pluginId + HEADER_BODY_CLASS, endpoints.getBroadcastFrontendUri()))). to(endpoints.getBroadcastFrontendUri()). routeId(endpoints.getFrontendSendRouteId()); }
@Override public void configure() { from(timerEP).routeId("timerToDirect") .setHeader("context") .constant("simple") .setBody() .constant("Camel CDI Example 1") .log("Message received : ${body} for the Context : ${header.context}") .setHeader("header.message") .simple("properties:header.message") .log("Message received : ${body} for the header : ${header.header.message}") .to(directEP); from(directEP).routeId("directToBean") .setBody() .constant("CDI") .bean(helloBean, "sayHello") .log(">> Response : ${body}"); } }
@Override public void configure() throws Exception { // use http4 with rest dsl producer restConfiguration().producerComponent("http4") // to call rest service on localhost:8080 (the REST service from GeoRestController) .host("localhost").port(8080); // trigger the route every 5th second from("timer:foo?period=5000") // set a random city to use .setHeader("city", RestProducerRoute::randomCity) // use the rest producer to call the rest service .to("rest:get:country/{city}") // transform the response to grab a nice human readable .transform().jsonpath("$.results[0].formattedAddress") // print the response .log("${body}"); }
@Override public void configure() throws Exception { from("file:ordersin?noop=true").id("order") .setHeader("customer", xpath("/order/customer/text()").stringResult()) .split(xpath("/order/item")) .setHeader("count", xpath("/item/@count").stringResult()) .setHeader("name", xpath("/item/@name").stringResult()) .choice() .when(xpath("/item/@vendor != 'direct'")).to("direct:vendor") .otherwise().recipientList(simple("file:ordersout/${header.customer}")); from("direct:vendor").id("mailtovendor") .setHeader("to", method("vendorMailService")) .setHeader("subject", simple("Order from ${header.customer}")) .to("velocity:mailtemplate.txt") .to("stream:out") .to("smtp:{{mailserver}}"); } }
@Override public void configure() throws Exception { from("direct:input") .setHeader(Exchange.HTTP_METHOD, constant(HttpMethods.GET)) .toF("http4:localhost:%d", StandardTestContainer.DEMO_APP_PORT); from("mhd-iti68:download?audit=true") .errorHandler(noErrorHandler()) .transform(new Iti68Responder()); }
@Override public void configure() { from("direct:input") .toF("mhd-iti65:localhost:%d", FhirTestContainer.DEMO_APP_PORT); from("mhd-iti65:stub?audit=true&fhirContext=#fhirContext") .errorHandler(noErrorHandler()) .setHeader(ValidatorAdapter.NEED_VALIDATION_HEADER_NAME, constant(true)) .setHeader(VALIDATION_MODE, constant(SCHEMA | SCHEMATRON )) // | MODEL)) .process(itiRequestValidator()) .transform(new Responder()); // Start up a second transaction route, sharing the same resource provider // and the same FHIR context if (startSecondRoute) { from("batch:batch?audit=false&fhirContext=#fhirContext") .errorHandler(noErrorHandler()) .throwException(new UnprocessableEntityException("This sucks")); } }
@Override public void configure() throws Exception { from("direct:input") .toF("mhd-iti65:localhost:%d", FhirTestContainer.DEMO_APP_PORT); from("mhd-iti65:stub?audit=true") .errorHandler(noErrorHandler()) .setHeader(VALIDATION_MODE, constant(SCHEMA | MODEL)) .process(itiRequestValidator()) .transform(new Responder()); }