Skip to content

Latest commit

 

History

History
 
 

file-split-log-xml

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Tokenize a CSV file: A Camel Quarkus example

{cq-description}

In particular, it demonstrates the following:

  1. Reading a file using Camel file component as a consumer

  2. Splitting the file into rows

  3. Splitting the rows into columns

  4. Usage of properties defined in application.properties in a Camel endpoint URI

  5. No Java code required or used, the route defined in XML can still be compiled to native code.

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 Camel Quarkus User guide for prerequisites and other general information.

Start in the Development mode

$ mvn clean compile quarkus:dev

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 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 Camel Quarkus User guide

JVM mode

$ mvn clean package
$ java -jar target/quarkus-app/quarkus-run.jar
...

[io.quarkus] (main) camel-quarkus-examples-... started in 0.570s.

Native mode

Important
Native mode requires having GraalVM and other tools installed. Please check the Prerequisites section of Camel Quarkus User guide.

To prepare a native executable using GraalVM, run the following command:

$ mvn clean package -Pnative
$ ./target/*-runner
...
[io.quarkus] (main) camel-quarkus-examples-... started in 0.011s.
...

Feedback

Please report bugs and propose improvements via GitHub issues of Camel Quarkus project.