blob: 9e1165b4dcd97d5f5f23c615850d32c96bc5eb2e [file] [log] [blame]
= file-split-log-xml
This is a basic hello world example that uses XML to set-up a Camel file consumer which reads a file in the resources folder.
It demonstrates the following;
1. Reading a file using camel file endpoint as a consumer.
2. Splitting the file by row.
3. Splitting the row by columns.
4. Usage of properties in the camel endpoint uri.
5. No Java code required or used, the XML can still be compiled to native code. Pretty cool.
The file consumer has been marked as non-idempotent thus it will read the same file again using a configurable 30 second delay.
TIP: Check the https://camel.apache.org/camel-quarkus/latest/first-steps.html[Camel Quarkus User guide] for prerequisites
and other general information.
== Start in the Development mode
[source,shell]
----
$ mvn clean compile quarkus:dev -DnoDeps
----
The above command compiles the project, starts the application and lets the Quarkus tooling watch for changes in your
workspace. Any modifications in your project will automatically take effect in the running application.
TIP: Please refer to the Development mode section of
https://camel.apache.org/camel-quarkus/latest/first-steps.html#_development_mode[Camel Quarkus User guide] for more details.
Once the application has started it will wait 5 seconds and then read the file every 30 seconds. By default the row split
is sequential however you can edit the properties file and set the parallel processing to true. The output should then be
a little more out of order i.e. non-sequential processing of rows.
=== Package and run the application
Once you are done with developing you may want to package and run the application.
TIP: Find more details about the JVM mode and Native mode in the Package and run section of
https://camel.apache.org/camel-quarkus/latest/first-steps.html#_package_and_run_the_application[Camel Quarkus User guide]
==== JVM mode
[source,shell]
----
$ mvn clean package
$ java -jar target/*-runner.jar
...
[org.apa.cam.qua.cor.FastCamelContext] (main) Apache Camel 3.0.0 (CamelContext: camel-quarkus-xml) started in 0.081 seconds
----
==== Native mode
IMPORTANT: Native mode requires having GraalVM and other tools installed. Please check the Prerequisites section
of https://camel.apache.org/camel-quarkus/latest/first-steps.html#_prerequisites[Camel Quarkus User guide].
To prepare a native executable using GraalVM, run the following command:
[source,shell]
----
$ mvn clean package -Pnative
$ ./target/*-runner
...
[io.quarkus] (main) camel-quarkus-examples-file-log-xml 1.1.0-SNAPSHOT (running on Quarkus 1.1.0.Final) started in 0.011s.
...
----