0
votes

I developed a Spring Boot application which uses Apache Camel which runs just fine within my IDE IntelliJ IDEA.

My route is really simple as I just want to move one file from point A to point B. As long as I have configured my Camel-Endpoints in the application.properties everything works just fine and the file is successfully moved.

Now I wanted to try to call the same application from a Windows Batch file and override the Camel endpoint properties via the Command Line Arguments.

My .bat file looks like the following:

@echo off
set /p quelle="Quellverzeichnis: "
set /p ziel="Zielverzeichnis: "

java -jar -DQuelle=file://%quelle%?consumer.bridgeErrorHandler=true&idempotent=true&moveFailed=.\fehler&move=.\verarbeitet&maxMessagesPerPoll=1 -DZiel=file://%ziel% myapp.jar

pause

According to the documentation the Camel properties should be set via -D: https://camel.apache.org/spring-boot.html

but when I execute this command I only get the help from the commandline how commands should be defined. When I change it to Spring-Boot-Properties I get the error that the commands idempotent, moveFailed and maxMessagesPerPoll are unknown:

@echo off
set /p quelle="Quellverzeichnis: "
set /p ziel="Zielverzeichnis: "

java -jar myapp.jar --Quelle=file://%quelle%?consumer.bridgeErrorHandler=true&idempotent=true&moveFailed=.\fehler&move=.\verarbeitet&maxMessagesPerPoll=1 --Ziel=file://%ziel%

pause 

My question is: How do I define the Camel-Endpoints when I call my application from the command line?

1

1 Answers

0
votes

the jvm parameters needs to be put before the -jar

java -DQuelle=file://%quelle%?consumer.bridgeErrorHandler=true&idempotent=true&moveFailed=.\fehler&move=.\verarbeitet&maxMessagesPerPoll=1 -DZiel=file://%ziel% -jar  myapp.jar