Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package be.jschoreels.tmp.filetest;
- import org.apache.camel.Exchange;
- import org.apache.camel.LoggingLevel;
- import org.apache.camel.builder.RouteBuilder;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- /**
- * A Camel Java DSL Router
- */
- public class MyRouteBuilder extends RouteBuilder {
- Logger logger = LoggerFactory.getLogger(MyRouteBuilder.class);
- /**
- * Let's configure the Camel routing rules using Java code...
- */
- public void configure() {
- // here is a sample which processes the input files
- // (leaving them in place - see the 'noop' flag)
- // then performs content based routing on the message using XPath
- from("file:src/data?noop=true&idempotent=false&delay=1000&maxMessagesPerPoll=0")
- .routeId("fileConsumerRoute")
- .choice()
- .when(xpath("/person/city = 'London'"))
- .log(LoggingLevel.INFO, logger,"UK message")
- .to("file:target/messages/uk")
- .otherwise()
- .log(LoggingLevel.INFO, logger, "Other message")
- .to("file:target/messages/others")
- .end()
- .filter(header(Exchange.BATCH_COMPLETE))
- .to("controlbus:route?routeId=fileConsumerRoute&action=stop&async=false");
- }
- }
- [INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ filetest ---
- [ls.tmp.filetest.MainApp.main()] MainSupport INFO Apache Camel 2.14.4 starting
- [ls.tmp.filetest.MainApp.main()] DefaultCamelContext INFO Apache Camel 2.14.4 (CamelContext: camel-1) is starting
- [ls.tmp.filetest.MainApp.main()] ManagedManagementStrategy INFO JMX is enabled
- [ls.tmp.filetest.MainApp.main()] DefaultTypeConverter INFO Loaded 178 type converters
- [ls.tmp.filetest.MainApp.main()] DefaultCamelContext INFO AllowUseOriginalMessage is enabled. If access to the original message is not needed, then its recommended to turn this option off as it may improve performance.
- [ls.tmp.filetest.MainApp.main()] DefaultCamelContext INFO StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
- [ls.tmp.filetest.MainApp.main()] DefaultCamelContext INFO Route: fileConsumerRoute started and consuming from: Endpoint[file://src/data?delay=1000&idempotent=false&maxMessagesPerPoll=0&noop=true]
- [ls.tmp.filetest.MainApp.main()] DefaultCamelContext INFO Total 1 routes, of which 1 is started.
- [ls.tmp.filetest.MainApp.main()] DefaultCamelContext INFO Apache Camel 2.14.4 (CamelContext: camel-1) started in 0.300 seconds
- [1) thread #0 - file://src/data] rFileExclusiveReadLockStrategy WARN Deleting orphaned lock file: src/data/message2.xml.camelLock
- [1) thread #0 - file://src/data] XPathBuilder INFO Created default XPathFactory com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl@7703a837
- [1) thread #0 - file://src/data] MyRouteBuilder INFO UK message
- [1) thread #0 - file://src/data] MyRouteBuilder INFO Other message
- [1) thread #0 - file://src/data] DefaultShutdownStrategy INFO Starting to graceful shutdown 1 routes (timeout 300 seconds)
- [el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy INFO Waiting as there are still 2 inflight and pending exchanges to complete, timeout in 300 seconds.
- [el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy INFO Waiting as there are still 2 inflight and pending exchanges to complete, timeout in 299 seconds.
- [el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy INFO Waiting as there are still 2 inflight and pending exchanges to complete, timeout in 298 seconds.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement