Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

camel application properties are not overridden at runtime #3116

Closed
alainpham opened this issue Jul 5, 2019 · 8 comments
Closed

camel application properties are not overridden at runtime #3116

alainpham opened this issue Jul 5, 2019 · 8 comments
Labels
area/camel kind/bug Something isn't working triage/out-of-date This issue/PR is no longer valid or relevant

Comments

@alainpham
Copy link

Describe the bug
When using the camel extension, application properties such quarkus.camel.servlet.url-patterns or quarkus.camel.routes-uris are not overridden at runtime with the native executable.

Expected behavior
When overriding application variables with a config/application.properties file or environment variables. They should be taken into account by the executable.

Actual behavior
Still takes the value from the development version in resources/application.properties no matter what.

To Reproduce
Steps to reproduce the behavior:

  1. git clone https://github.com/alainpham/quarkus-kafka-camel-servlet.git
  2. cd quarkus-kafka-camel-servlet
  3. Add some configuration change regarding camel in the docker-compose.xml as environment vars file. We can try to change the url patterns or the uris to the routes.xml.
    environment:
      - 'MP_MESSAGING_INCOMING_IN_EVENTS_BOOTSTRAP_SERVERS=kafka:9092'
      - 'MP_MESSAGING_OUTGOING_OUT_EVENTS_BOOTSTRAP_SERVERS=kafka:9092'
      - 'QUARKUS_CAMEL_SERVLET_URL_PATTERNS=/camelsss/*'
      - 'QUARKUS_CAMEL_ROUTES_URIS=file:/camel/routessss.xml'
  1. docker-compose up
  2. The new values are not taken into account

Configuration

# Add your application.properties here, if applicable.

Screenshots
(If applicable, add screenshots to help explain your problem.)

Environment (please complete the following information):

  • Output of uname -a or ver: 3.10.0-957.21.3.el7.x86_64
  • Output of java -version:
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)
  • GraalVM version (if different from Java):
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-20190523183340.buildslave.jdk8u-src-tar--b03)
OpenJDK 64-Bit GraalVM CE 19.0.2 (build 25.212-b03-jvmci-19-b04, mixed mode)
  • Quarkus version or git rev: 0.18.0
@alainpham alainpham added the kind/bug Something isn't working label Jul 5, 2019
@geoand
Copy link
Contributor

geoand commented Jul 5, 2019

The corresponding Camel Config is configurable at build time only as can be seen here.

It very much looks like that was intentional but I have no experience with Camel on Quarkus so I can't provide any meaningful insight here

@alainpham
Copy link
Author

Ok, thanks. I just discovered that there were different Configuration Root Phases. It does make sense for most of those properties to be fixed & unchangeable at run time like disable jaxb & xml, however I think that routesUris should be changeable at run time. When I configure routesUris to read a file on some file system path, the file is read dynamically during run time even with the native executable. But maybe there is something I'm missing here that would have a big impact if we make it changeable during run time.

@gsmet
Copy link
Member

gsmet commented Jul 6, 2019

@alainpham yes, it makes perfectly sense.

@lburgazzoli ?

@geoand
Copy link
Contributor

geoand commented Jul 6, 2019

It's probably best to ping the author(s) of the extension to get more feedback on the questions you raised.

@lburgazzoli
Copy link
Contributor

lburgazzoli commented Jul 7, 2019

@alainpham there is a property deferInitPhase that changes the way camel deal with routes: if set to true, routes are loaded at runtime however this reduces the optimization that camel can do as when building the route at build time, then the materialization of the route to the underlying processors is is not needed any more at runtime which has some benefit in term of memory and start-up time

@alainpham
Copy link
Author

Thanks for the hint @lburgazzoli. I wan't so sure about what deferInitPhase really meant. The picture is becoming a bit clearer now but I still have to figure out a few things.

  1. If deferinitPhase=false, does that mean that the option -H:IncludeResources=... must to be added so that the resources are part of the native executable or are the xml routes declared in the property routesUris automatically baked into the executable?

  2. If deferinitPhase=true then, wouldn't it make sense to have the property routesUris configured as ConfigPhase.RUN_TIME, to be able to then change it during runtime?

Many thanks.

@lburgazzoli
Copy link
Contributor

Thanks for the hint @lburgazzoli. I wan't so sure about what deferInitPhase really meant. The picture is becoming a bit clearer now but I still have to figure out a few things.

1. If `deferinitPhase=false`, does that mean that the option `-H:IncludeResources=...` must to be added so that the resources are part of the native executable or are the xml routes declared in the property `routesUris` automatically baked into the executable?

As I can recall, in such cases the resources are not included but they are processed at build time so the generated bytecode contains the materialized routes and there's no more need to have the original XMLs.

2. If `deferinitPhase=true` then, wouldn't it make sense to have the property `routesUris` configured as `ConfigPhase.RUN_TIME`, to be able to then change it during runtime?

That make sense. We are now in the process of moving camel-quarkus in its new home ad we have a number of thing to improve, can you raise an issue there ?

Many thanks.

@alainpham
Copy link
Author

alainpham commented Jul 9, 2019

@lburgazzoli, thanks it's clear to me now.
Sure I'll raise the issue on the apache repos.

Many thanks

Edit : the newly opened issue can be found here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/camel kind/bug Something isn't working triage/out-of-date This issue/PR is no longer valid or relevant
Projects
None yet
Development

No branches or pull requests

4 participants