{cq-description}
Tip
|
Check the Camel Quarkus User guide for prerequisites and other general information. |
The example application requires a running FTP server. For simplicity, you can start one with Docker.
docker run -ti --rm -p 2222:2222 \
-e PASSWORD_ACCESS=true \
-e USER_NAME=ftpuser \
-e USER_PASSWORD=ftppassword \
-e DOCKER_MODS=linuxserver/mods:openssh-server-openssh-client \
linuxserver/openssh-server
If you prefer to use a different server, then the properties prefixed with ftp.
in src/main/resources/application.properties
can be adjusted for this purpose.
Ensure the aforementioned FTP server is running and do the following to run the application in 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. |
You should start to see some log messages appearing on the console.
Every 10 seconds the timer component triggers the generation of some random 'books' data and creates a CSV file in a temporary directory with 100 entries.
[route1] (Camel (camel-1) thread #3 - timer://generateBooks) Generating randomized books CSV data
Next the CSV file is read by a file consumer and Bindy is used to marshal the individual data rows into Book
objects.
[route2] (Camel (camel-1) thread #1 - file:///tmp/books) Reading books CSV data from 89A0EE24CB03A69-0000000000000000
Next the collection of Book
objects is split into individual items and is aggregated based on the genre
property.
[route3] (Camel (camel-1) thread #0 - AggregateTimeoutChecker) Processed 34 books for genre 'Action'
[route3] (Camel (camel-1) thread #0 - AggregateTimeoutChecker) Processed 31 books for genre 'Crime'
[route3] (Camel (camel-1) thread #0 - AggregateTimeoutChecker) Processed 35 books for genre 'Horror'
Finally, the aggregated book collections are unmarshalled back to CSV format and uploaded to the test FTP server.
[route4] (Camel (camel-1) thread #2 - seda://processed) Uploaded books-Action-89A0EE24CB03A69-0000000000000069.csv
[route4] (Camel (camel-1) thread #2 - seda://processed) Uploaded books-Crime-89A0EE24CB03A69-0000000000000069.csv
[route4] (Camel (camel-1) thread #2 - seda://processed) Uploaded books-Horror-89A0EE24CB03A69-0000000000000069.csv
Once you are done with developing you may want to package and run the application.
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 -DskipTests -Pnative
$ ./target/*-runner
To deploy the application to OpenShift run the following command.
$ mvn clean package -DskipTests -Dquarkus.kubernetes.deploy=true -Pnative
Check pods are running.
$ oc get pods
NAME READY STATUS RESTARTS AGE
camel-quarkus-examples-file-bindy-ftp-5d48f4d85c-sjl8k 1/1 Running 0 21s
ssh-server-deployment-5c667bccfc-52xfz 1/1 Running 0 21s
Tail the application logs.
$ oc logs -f camel-quarkus-examples-file-bindy-ftp-5d48f4d85c-sjl8k
To clean up do.
$ oc delete all -l app.kubernetes.io/name=camel-quarkus-examples-file-bindy-ftp
Note
|
If you need to configure container resource limits & requests, or enable the Quarkus Kubernetes client to trust self signed certificates, you can find these configuration options in |
For more information about deploying Quarkus applications to OpenShift, refer to the documentation.