Advertisement
bltijo

Untitled

May 15th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.77 KB | None | 0 0
  1. package be.jschoreels.tmp.filetest;
  2.  
  3. import org.apache.camel.Exchange;
  4. import org.apache.camel.LoggingLevel;
  5. import org.apache.camel.builder.RouteBuilder;
  6. import org.slf4j.Logger;
  7. import org.slf4j.LoggerFactory;
  8.  
  9. /**
  10.  * A Camel Java DSL Router
  11.  */
  12. public class MyRouteBuilder extends RouteBuilder {
  13.  
  14.     Logger logger = LoggerFactory.getLogger(MyRouteBuilder.class);
  15.  
  16.     /**
  17.      * Let's configure the Camel routing rules using Java code...
  18.      */
  19.     public void configure() {
  20.  
  21.         // here is a sample which processes the input files
  22.         // (leaving them in place - see the 'noop' flag)
  23.         // then performs content based routing on the message using XPath
  24.         from("file:src/data?noop=true&idempotent=false&delay=1000&maxMessagesPerPoll=0")
  25.             .routeId("fileConsumerRoute")
  26.             .choice()
  27.                 .when(xpath("/person/city = 'London'"))
  28.                     .log(LoggingLevel.INFO, logger,"UK message")
  29.                     .to("file:target/messages/uk")
  30.                 .otherwise()
  31.                     .log(LoggingLevel.INFO, logger, "Other message")
  32.                     .to("file:target/messages/others")
  33.             .end()
  34.             .filter(header(Exchange.BATCH_COMPLETE))
  35.             .to("controlbus:route?routeId=fileConsumerRoute&action=stop&async=false");
  36.     }
  37.  
  38. }
  39.  
  40.  
  41. [INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ filetest ---
  42. [ls.tmp.filetest.MainApp.main()] MainSupport                    INFO  Apache Camel 2.14.4 starting
  43. [ls.tmp.filetest.MainApp.main()] DefaultCamelContext            INFO  Apache Camel 2.14.4 (CamelContext: camel-1) is starting
  44. [ls.tmp.filetest.MainApp.main()] ManagedManagementStrategy      INFO  JMX is enabled
  45. [ls.tmp.filetest.MainApp.main()] DefaultTypeConverter           INFO  Loaded 178 type converters
  46. [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.
  47. [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
  48. [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]
  49. [ls.tmp.filetest.MainApp.main()] DefaultCamelContext            INFO  Total 1 routes, of which 1 is started.
  50. [ls.tmp.filetest.MainApp.main()] DefaultCamelContext            INFO  Apache Camel 2.14.4 (CamelContext: camel-1) started in 0.300 seconds
  51. [1) thread #0 - file://src/data] rFileExclusiveReadLockStrategy WARN  Deleting orphaned lock file: src/data/message2.xml.camelLock
  52. [1) thread #0 - file://src/data] XPathBuilder                   INFO  Created default XPathFactory com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl@7703a837
  53. [1) thread #0 - file://src/data] MyRouteBuilder                 INFO  UK message
  54. [1) thread #0 - file://src/data] MyRouteBuilder                 INFO  Other message
  55. [1) thread #0 - file://src/data] DefaultShutdownStrategy        INFO  Starting to graceful shutdown 1 routes (timeout 300 seconds)
  56. [el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy        INFO  Waiting as there are still 2 inflight and pending exchanges to complete, timeout in 300 seconds.
  57. [el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy        INFO  Waiting as there are still 2 inflight and pending exchanges to complete, timeout in 299 seconds.
  58. [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