ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel URL: https://github.com/apache/camel-quarkus/pull/226#discussion_r331497667
########## File path: extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/runtime/CamelRecorder.java ########## @@ -16,88 +16,98 @@ */ package org.apache.camel.quarkus.core.runtime; -import io.quarkus.arc.runtime.BeanContainerListener; +import java.util.function.Supplier; + +import io.quarkus.arc.runtime.BeanContainer; import io.quarkus.runtime.RuntimeValue; -import io.quarkus.runtime.ShutdownContext; import io.quarkus.runtime.annotations.Recorder; -import org.apache.camel.RoutesBuilder; -import org.apache.camel.quarkus.core.runtime.support.FastCamelRuntime; +import org.apache.camel.CamelContext; +import org.apache.camel.ExtendedCamelContext; +import org.apache.camel.RuntimeCamelException; +import org.apache.camel.quarkus.core.runtime.support.FastCamelContext; +import org.apache.camel.quarkus.core.runtime.support.FastModel; +import org.apache.camel.quarkus.core.runtime.support.RuntimeRegistry; import org.apache.camel.spi.Registry; +import org.graalvm.nativeimage.ImageInfo; @Recorder public class CamelRecorder { - public RuntimeValue<CamelRuntime> create(Registry registry) { - - FastCamelRuntime fcr = new FastCamelRuntime(); - fcr.setRegistry(registry); - - return new RuntimeValue<>(fcr); - } - - public void init( - RuntimeValue<CamelRuntime> runtime, - CamelConfig.BuildTime buildTimeConfig) { - - FastCamelRuntime fcr = (FastCamelRuntime) runtime.getValue(); - fcr.init(buildTimeConfig); + public RuntimeValue<Registry> createRegistry() { + return new RuntimeValue<>(new RuntimeRegistry()); } - public void start( - ShutdownContext shutdown, - RuntimeValue<CamelRuntime> runtime, - CamelConfig.Runtime runtimeConfig) throws Exception { + @SuppressWarnings("unchecked") + public RuntimeValue<CamelContext> createContext(RuntimeValue<Registry> registry, BeanContainer beanContainer, CamelConfig.BuildTime buildTimeConfig) { Review comment: True, the set of all current callers is the ultimate source of the truth for each recorder method. But isn't this particular method based in the assumption that it will be called exactly once in a very specific phase? I guess these assumptions are supposed to stay rather stable over time and any future change will require a thorough review. Therefore documenting the assumptions might be a good idea. Maybe I am just projecting something into the code that really is not there? I do not want to nitpick, I want to understand myself and eventually make the understanding easier to the people who will read the code after us. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services