Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-16850

camel-main - Unable to reference properties after bootstrap

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.11.0
    • Fix Version/s: 3.11.2, 3.12.0
    • Component/s: camel-main
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      The MainBootstrapCloseable clears and sets to null initial properties, override properties wildcard properties and main configuration properties on bootstrap of Camel context. Adding a route that depends on those properties after bootstrap is therefore no longer possible.

      The value MainBootstrapCloseable has in static route configurations is at odds in dynamic route configurations.

      Example (obviously not production code):

      final Main main = new Main();main.addInitialProperty("prop", "value");
      try (MainConfigurationProperties conf = main.configure()) {
      	conf.addRoutesBuilder(new RouteBuilder() {
      		@Override
      		public void configure() throws Exception {
      			from("timer:one").log("{{prop}}").process(e -> e.getContext().addRoutes(new RouteBuilder() {
      				@Override
      				public void configure() throws Exception {
      					from("timer:two").log("{{prop}}");
      				}
      			}));
      		}
      	});
      	main.run();
      } 

      Should the MainBootstrapCloseable be removed, or should the properties component be configured to incorporate these properties?

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              zregvart Zoran Regvart
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: