This commit is contained in:
parent
a411fd0561
commit
2e2ac76b45
|
@ -44,7 +44,7 @@
|
|||
|
||||
<properties>
|
||||
<javax.validation.validation-api.version>2.0.1.Final</javax.validation.validation-api.version>
|
||||
<camel.version>4.3.0</camel.version>
|
||||
<camel.version>4.4.1</camel.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -7,7 +7,7 @@ public class CamelLoggingMainApp {
|
|||
public static void main(String[] args) throws Exception {
|
||||
Main main = new Main();
|
||||
main.configure()
|
||||
.addRoutesBuilder(new FileCopierTracerCamelRoute());
|
||||
.addRoutesBuilder(new FileCopierCamelRoute());
|
||||
main.run(args);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.baeldung.apachecamellogging;
|
||||
|
||||
import org.apache.camel.Exchange;
|
||||
import org.apache.camel.Processor;
|
||||
import org.apache.camel.LoggingLevel;
|
||||
import org.apache.camel.builder.RouteBuilder;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
@ -9,19 +8,19 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
public class FileCopierCamelRoute extends RouteBuilder {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(FileCopierCamelRoute.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(FileCopierCamelRoute.class);
|
||||
|
||||
public void configure() {
|
||||
from("file:data/inbox?noop=true").log("We got an incoming file ${file:name} containing: ${body}")
|
||||
.to("log:com.baeldung.apachecamellogging?level=INFO")
|
||||
.process(new Processor() {
|
||||
@Override
|
||||
public void process(Exchange exchange) throws Exception {
|
||||
logger.info("We are passing the message to a FileProcesor to Capitalize the message body");
|
||||
}
|
||||
|
||||
.process(process -> {
|
||||
LOGGER.info("We are passing the message to a FileProcesor bean to capitalize the message body");
|
||||
})
|
||||
.bean(FileProcessor.class)
|
||||
.to("file:data/outbox")
|
||||
.to("log:com.baeldung.apachecamellogging?showBodyType=false&maxChars=20")
|
||||
.log(LoggingLevel.DEBUG, "Output Process", "The Process ${id}")
|
||||
.log("Successlly transfer file: ${file:name}");
|
||||
}
|
||||
}
|
|
@ -18,6 +18,5 @@ public class FileCopierTracerCamelRoute extends RouteBuilder {
|
|||
.marshal()
|
||||
.json(JsonLibrary.Jackson)
|
||||
.to("file:data/output");
|
||||
;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue