[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #226: Use MainSupport as base for running Camel

2019-10-05 Thread GitBox
lburgazzoli 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_r331736686
 
 

 ##
 File path: 
extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/RuntimeBeanRepository.java
 ##
 @@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.core;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.camel.spi.BeanRepository;
+
+public final class RuntimeBeanRepository implements BeanRepository {
 
 Review comment:
   I've inlined it but can we please be pragmatic an try to solve one problem 
at time ? 
   
   BeanManagerHelper was there long before this PR and was used in very same 
way so to me it is unrelated to this PR. 


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


[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #226: Use MainSupport as base for running Camel

2019-10-04 Thread GitBox
lburgazzoli 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_r331734008
 
 

 ##
 File path: 
extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelConfig.java
 ##
 @@ -55,6 +47,21 @@
  */
 @ConfigItem(defaultValue = "false")
 public boolean disableXml;
+
+/**
+ * Disable camel-main.
+ * When main is disabled, routes won't be automatically be loaded and
+ * started and the entire lifecycle of the Camel Context is under user
+ * control.
+ */
+@ConfigItem(defaultValue = "false")
+public boolean disableMain;
 
 Review comment:
   It uses negation to be consistent with other properties


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


[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #226: Use MainSupport as base for running Camel

2019-10-04 Thread GitBox
lburgazzoli 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_r331734010
 
 

 ##
 File path: 
extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/Flags.java
 ##
 @@ -38,4 +38,10 @@ public boolean getAsBoolean() {
 }
 }
 
+public static final class MainDisabled implements BooleanSupplier {
 
 Review comment:
   Same as above


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


[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #226: Use MainSupport as base for running Camel

2019-10-04 Thread GitBox
lburgazzoli 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_r331489009
 
 

 ##
 File path: integration-tests/aws/pom.xml
 ##
 @@ -30,6 +30,10 @@
 The camel integration tests
 
 
+
+org.apache.camel.quarkus
+camel-quarkus-main
+
 
 Review comment:
   You want to have a better control about the context initialization, set-up 
and life cycle as example.


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


[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #226: Use MainSupport as base for running Camel

2019-10-04 Thread GitBox
lburgazzoli 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_r331487758
 
 

 ##
 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 create(Registry registry) {
-
-FastCamelRuntime fcr = new FastCamelRuntime();
-fcr.setRegistry(registry);
-
-return new RuntimeValue<>(fcr);
-}
-
-public void init(
-RuntimeValue runtime,
-CamelConfig.BuildTime buildTimeConfig) {
-
-FastCamelRuntime fcr = (FastCamelRuntime) runtime.getValue();
-fcr.init(buildTimeConfig);
+public RuntimeValue createRegistry() {
+return new RuntimeValue<>(new RuntimeRegistry());
 }
 
-public void start(
-ShutdownContext shutdown,
-RuntimeValue runtime,
-CamelConfig.Runtime runtimeConfig) throws Exception {
+@SuppressWarnings("unchecked")
+public RuntimeValue createContext(RuntimeValue 
registry, BeanContainer beanContainer, CamelConfig.BuildTime buildTimeConfig) {
 
 Review comment:
   I can add them but it does not give much info and guarantees as in fact the 
behaviour depends to the target phase of the build steps that invokes the 
recorder.


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


[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #226: Use MainSupport as base for running Camel

2019-10-04 Thread GitBox
lburgazzoli 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_r331477835
 
 

 ##
 File path: integration-tests/aws/pom.xml
 ##
 @@ -30,6 +30,10 @@
 The camel integration tests
 
 
+
+org.apache.camel.quarkus
+camel-quarkus-main
+
 
 Review comment:
   camel-quarkus-core is supposed to be used by people who want to create their 
own "main" whereas camel-quarkus-main does provide a ready to use "main" so no, 
component extensions should not depends on main otherwise it won't be possible 
for people to create their own main


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


[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #226: Use MainSupport as base for running Camel

2019-10-04 Thread GitBox
lburgazzoli 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_r331477047
 
 

 ##
 File path: 
extensions/servlet/deployment/src/test/java/org/apache/camel/quarkus/component/servlet/test/CustomDefaultServletClassTest.java
 ##
 @@ -30,25 +37,45 @@
 @RegisterExtension
 static final QuarkusUnitTest CONFIG = new QuarkusUnitTest()
 .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
-.addClasses(Routes.class)
-.addAsResource(new StringAsset(
-"quarkus.camel.servlet.url-patterns=/*\n"
-+ "quarkus.camel.servlet.servlet-name=my-named-servlet\n"
-+ "quarkus.camel.servlet.servlet-class=" + 
CustomServlet.class.getName() + "\n"),
-"application.properties"));
+.addAsResource(applicationProperties(), "application.properties"));
 
 @Test
-public void customDefaultServletClass() {
-RestAssured.when().get("/custom").then()
-.body(IsEqual.equalTo("GET: /custom"))
-.and().header("x-servlet-class-name", 
CustomServlet.class.getName());
+public void customDefaultServletClass() throws Exception {
+DefaultCamelContext context = new DefaultCamelContext();
+context.addRoutes(new Routes());
+context.start();
 
 Review comment:
   camel-core does not loads routes anymore


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


[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #226: Use MainSupport as base for running Camel

2019-10-04 Thread GitBox
lburgazzoli 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_r331473156
 
 

 ##
 File path: 
extensions/main/deployment/src/main/java/org/apache/camel/quarkus/main/deployment/SubstrateProcessor.java
 ##
 @@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.main.deployment;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
+import io.quarkus.deployment.builditem.substrate.ReflectiveClassBuildItem;
+import org.apache.camel.quarkus.core.deployment.CamelSupport;
+import org.jboss.jandex.IndexView;
+
+public class SubstrateProcessor {
 
 Review comment:
   `SubstrateProcessor` is meant to contains build steps related to substrate 
like reflection, substrate properties and so on. The distinction is juts 
logical so one know where to look depending of the context.  


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


[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #226: Use MainSupport as base for running Camel

2019-10-04 Thread GitBox
lburgazzoli 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_r331443049
 
 

 ##
 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 create(Registry registry) {
-
-FastCamelRuntime fcr = new FastCamelRuntime();
-fcr.setRegistry(registry);
-
-return new RuntimeValue<>(fcr);
-}
-
-public void init(
-RuntimeValue runtime,
-CamelConfig.BuildTime buildTimeConfig) {
-
-FastCamelRuntime fcr = (FastCamelRuntime) runtime.getValue();
-fcr.init(buildTimeConfig);
+public RuntimeValue createRegistry() {
+return new RuntimeValue<>(new RuntimeRegistry());
 }
 
-public void start(
-ShutdownContext shutdown,
-RuntimeValue runtime,
-CamelConfig.Runtime runtimeConfig) throws Exception {
+@SuppressWarnings("unchecked")
+public RuntimeValue createContext(RuntimeValue 
registry, BeanContainer beanContainer, CamelConfig.BuildTime buildTimeConfig) {
+FastCamelContext context = new FastCamelContext();
+context.setRegistry(registry.getValue());
+context.setLoadTypeConverters(false);
+context.getTypeConverterRegistry().setInjector(context.getInjector());
 
-runtime.getValue().start(runtimeConfig);
-
-//in development mode undertow is started eagerly
-shutdown.addShutdownTask(new Runnable() {
-@Override
-public void run() {
-try {
-runtime.getValue().stop();
-} catch (Exception e) {
-throw new RuntimeException(e);
+try {
+if (buildTimeConfig.disableJaxb) {
+
context.adapt(ExtendedCamelContext.class).setModelJAXBContextFactory(() -> {
+throw new UnsupportedOperationException();
+});
+} else {
+// The creation of the JAXB context is very time consuming, so 
always prepare it
+// when running in native mode, but lazy create it in java 
mode so that we don't
+// waste time if using java routes
+if (ImageInfo.inImageBuildtimeCode()) {
+
context.adapt(ExtendedCamelContext.class).getModelJAXBContextFactory().newJAXBContext();
 }
 }
-});
-}
+} catch (Exception e) {
+throw RuntimeCamelException.wrapRuntimeCamelException(e);
+}
 
-public void addBuilder(
-RuntimeValue runtime,
-String className) {
+FastModel model = new FastModel(context);
 
-FastCamelRuntime fcr = (FastCamelRuntime) runtime.getValue();
+context.setModel(model);
+context.init();
 
-try {
-fcr.getBuilders().add((RoutesBuilder) 
Class.forName(className).newInstance());
-} catch (Exception e) {
-throw new RuntimeException(e);
-}
+// register to the container
+beanContainer.instance(CamelProducers.class).setContext(context);
+
+return new RuntimeValue<>(context);
 }
 
 public void bind(
-RuntimeValue runtime,
+RuntimeValue runtime,
 String name,
 Class type,
 Object instance) {
 
-runtime.getValue().getRegistry().bind(name, type, instance);
+runtime.getValue().bind(name, type, instance);
 }
 
 public void bind(
-RuntimeValue runtime,
+RuntimeValue runtime,
 String name,
 Class type) {
 
 try {
-runtime.getValue().getRegistry().bind(name, type, 
type.newInstance());
+runtime.getValue().bind(name, type, type.newInstance());
 } catch (Exception e) {
 throw new RuntimeException(e);
 }
 }
 
-public BeanContainerListener 
initRuntimeInjection(RuntimeValue runtime) {
-   

[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #226: Use MainSupport as base for running Camel

2019-10-04 Thread GitBox
lburgazzoli 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_r331443025
 
 

 ##
 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 create(Registry registry) {
-
-FastCamelRuntime fcr = new FastCamelRuntime();
-fcr.setRegistry(registry);
-
-return new RuntimeValue<>(fcr);
-}
-
-public void init(
-RuntimeValue runtime,
-CamelConfig.BuildTime buildTimeConfig) {
-
-FastCamelRuntime fcr = (FastCamelRuntime) runtime.getValue();
-fcr.init(buildTimeConfig);
+public RuntimeValue createRegistry() {
+return new RuntimeValue<>(new RuntimeRegistry());
 }
 
-public void start(
-ShutdownContext shutdown,
-RuntimeValue runtime,
-CamelConfig.Runtime runtimeConfig) throws Exception {
+@SuppressWarnings("unchecked")
+public RuntimeValue createContext(RuntimeValue 
registry, BeanContainer beanContainer, CamelConfig.BuildTime buildTimeConfig) {
+FastCamelContext context = new FastCamelContext();
+context.setRegistry(registry.getValue());
+context.setLoadTypeConverters(false);
+context.getTypeConverterRegistry().setInjector(context.getInjector());
 
-runtime.getValue().start(runtimeConfig);
-
-//in development mode undertow is started eagerly
-shutdown.addShutdownTask(new Runnable() {
-@Override
-public void run() {
-try {
-runtime.getValue().stop();
-} catch (Exception e) {
-throw new RuntimeException(e);
+try {
+if (buildTimeConfig.disableJaxb) {
+
context.adapt(ExtendedCamelContext.class).setModelJAXBContextFactory(() -> {
+throw new UnsupportedOperationException();
+});
+} else {
+// The creation of the JAXB context is very time consuming, so 
always prepare it
+// when running in native mode, but lazy create it in java 
mode so that we don't
+// waste time if using java routes
+if (ImageInfo.inImageBuildtimeCode()) {
+
context.adapt(ExtendedCamelContext.class).getModelJAXBContextFactory().newJAXBContext();
 }
 }
-});
-}
+} catch (Exception e) {
+throw RuntimeCamelException.wrapRuntimeCamelException(e);
+}
 
-public void addBuilder(
-RuntimeValue runtime,
-String className) {
+FastModel model = new FastModel(context);
 
-FastCamelRuntime fcr = (FastCamelRuntime) runtime.getValue();
+context.setModel(model);
+context.init();
 
-try {
-fcr.getBuilders().add((RoutesBuilder) 
Class.forName(className).newInstance());
-} catch (Exception e) {
-throw new RuntimeException(e);
-}
+// register to the container
+beanContainer.instance(CamelProducers.class).setContext(context);
+
+return new RuntimeValue<>(context);
 }
 
 public void bind(
-RuntimeValue runtime,
+RuntimeValue runtime,
 String name,
 Class type,
 Object instance) {
 
-runtime.getValue().getRegistry().bind(name, type, instance);
+runtime.getValue().bind(name, type, instance);
 }
 
 public void bind(
-RuntimeValue runtime,
+RuntimeValue runtime,
 String name,
 Class type) {
 
 try {
-runtime.getValue().getRegistry().bind(name, type, 
type.newInstance());
+runtime.getValue().bind(name, type, type.newInstance());
 } catch (Exception e) {
 throw new RuntimeException(e);
 }
 }
 
-public BeanContainerListener 
initRuntimeInjection(RuntimeValue runtime) {
-   

[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #226: Use MainSupport as base for running Camel

2019-10-04 Thread GitBox
lburgazzoli 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_r331442824
 
 

 ##
 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 create(Registry registry) {
-
-FastCamelRuntime fcr = new FastCamelRuntime();
-fcr.setRegistry(registry);
-
-return new RuntimeValue<>(fcr);
-}
-
-public void init(
-RuntimeValue runtime,
-CamelConfig.BuildTime buildTimeConfig) {
-
-FastCamelRuntime fcr = (FastCamelRuntime) runtime.getValue();
-fcr.init(buildTimeConfig);
+public RuntimeValue createRegistry() {
+return new RuntimeValue<>(new RuntimeRegistry());
 }
 
-public void start(
-ShutdownContext shutdown,
-RuntimeValue runtime,
-CamelConfig.Runtime runtimeConfig) throws Exception {
+@SuppressWarnings("unchecked")
+public RuntimeValue createContext(RuntimeValue 
registry, BeanContainer beanContainer, CamelConfig.BuildTime buildTimeConfig) {
 
 Review comment:
   I don't think we need to explicit the phase here as for the recorder POV, it 
does not matter.


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


[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #226: Use MainSupport as base for running Camel

2019-10-04 Thread GitBox
lburgazzoli 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_r331431933
 
 

 ##
 File path: 
extensions/main/deployment/src/main/java/org/apache/camel/quarkus/main/deployment/support/CamelMainBuildItem.java
 ##
 @@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.main.deployment.support;
+
+import io.quarkus.builder.item.SimpleBuildItem;
+import io.quarkus.runtime.RuntimeValue;
+import org.apache.camel.quarkus.main.CamelMain;
+
+public final class CamelMainBuildItem extends SimpleBuildItem {
 
 Review comment:
   they don't need to be separate, probably a leftover of something I was 
working on


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


[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #226: Use MainSupport as base for running Camel

2019-10-04 Thread GitBox
lburgazzoli 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_r331431643
 
 

 ##
 File path: 
extensions/main/deployment/src/main/java/org/apache/camel/quarkus/main/deployment/SubstrateProcessor.java
 ##
 @@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.main.deployment;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
+import io.quarkus.deployment.builditem.substrate.ReflectiveClassBuildItem;
+import org.apache.camel.quarkus.core.deployment.CamelSupport;
+import org.jboss.jandex.IndexView;
+
+public class SubstrateProcessor {
 
 Review comment:
   what do you mean by two processors ?


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


[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #226: Use MainSupport as base for running Camel

2019-10-04 Thread GitBox
lburgazzoli 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_r331430884
 
 

 ##
 File path: 
extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/runtime/CamelProducers.java
 ##
 @@ -16,51 +16,41 @@
  */
 package org.apache.camel.quarkus.core.runtime;
 
-import javax.enterprise.context.ApplicationScoped;
 import javax.enterprise.inject.Produces;
+import javax.inject.Singleton;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.ConsumerTemplate;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.spi.Registry;
 
-@ApplicationScoped
+@Singleton
 public class CamelProducers {
+private CamelContext context;
 
 Review comment:
   this is set by a recorder, don't know if make any difference


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


[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #226: Use MainSupport as base for running Camel

2019-10-04 Thread GitBox
lburgazzoli 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_r331379660
 
 

 ##
 File path: 
extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/runtime/support/FastCamelContext.java
 ##
 @@ -365,11 +388,12 @@ public AsyncProcessor 
createMulticast(Collection processors, Executor
 @SuppressWarnings("unchecked")
 protected  T resolve(Class clazz, String type, String name, 
CamelContext context) {
 
 Review comment:
   done


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


[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #226: Use MainSupport as base for running Camel

2019-10-04 Thread GitBox
lburgazzoli 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_r331379603
 
 

 ##
 File path: 
extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelSupport.java
 ##
 @@ -56,4 +69,67 @@ public static boolean isPublic(ClassInfo ci) {
 .flatMap(CamelSupport::safeWalk)
 .filter(Files::isRegularFile);
 }
+
+public static Stream getRouteBuilderClasses(IndexView view) {
+Set allKnownImplementors = new HashSet<>();
+allKnownImplementors.addAll(
+
view.getAllKnownImplementors(DotName.createSimple(RoutesBuilder.class.getName(;
+allKnownImplementors.addAll(
+
view.getAllKnownSubclasses(DotName.createSimple(RouteBuilder.class.getName(;
+allKnownImplementors.addAll(
+
view.getAllKnownSubclasses(DotName.createSimple(AdviceWithRouteBuilder.class.getName(;
+
+return allKnownImplementors
+.stream()
+.filter(CamelSupport::isConcrete)
+.filter(CamelSupport::isPublic)
+.map(ClassInfo::toString);
+}
+
+public static Stream services(ApplicationArchivesBuildItem 
applicationArchivesBuildItem) {
+return CamelSupport.resources(applicationArchivesBuildItem, 
CamelSupport.CAMEL_SERVICE_BASE_PATH)
+.map(CamelSupport::services)
+.flatMap(Collection::stream);
+}
+
+public static List services(Path p) {
 
 Review comment:
   done


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


[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #226: Use MainSupport as base for running Camel

2019-10-04 Thread GitBox
lburgazzoli 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_r331379356
 
 

 ##
 File path: 
extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelSupport.java
 ##
 @@ -56,4 +69,67 @@ public static boolean isPublic(ClassInfo ci) {
 .flatMap(CamelSupport::safeWalk)
 .filter(Files::isRegularFile);
 }
+
+public static Stream getRouteBuilderClasses(IndexView view) {
+Set allKnownImplementors = new HashSet<>();
 
 Review comment:
   https://issues.apache.org/jira/browse/CAMEL-14031


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


[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #226: Use MainSupport as base for running Camel

2019-10-04 Thread GitBox
lburgazzoli 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_r331373271
 
 

 ##
 File path: 
extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelSupport.java
 ##
 @@ -56,4 +69,67 @@ public static boolean isPublic(ClassInfo ci) {
 .flatMap(CamelSupport::safeWalk)
 .filter(Files::isRegularFile);
 }
+
+public static Stream getRouteBuilderClasses(IndexView view) {
+Set allKnownImplementors = new HashSet<>();
 
 Review comment:
   As far as I remember you can order things in spring-boot but we can assume 
that a routes that have an explicit order should take the precedence over any 
other ordering mechanics.
   
   Needs to be tested but we can also document that the preferred way of 
ordering routes is through the Camel's Ordered interface. 


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


[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #226: Use MainSupport as base for running Camel

2019-10-04 Thread GitBox
lburgazzoli 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_r331371275
 
 

 ##
 File path: 
extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/runtime/support/FastCamelContext.java
 ##
 @@ -365,11 +388,12 @@ public AsyncProcessor 
createMulticast(Collection processors, Executor
 @SuppressWarnings("unchecked")
 protected  T resolve(Class clazz, String type, String name, 
CamelContext context) {
 
 Review comment:
   it was originally used to auto configure component, languages and data 
formats but it is not more needed now as MainSupport does it, let me revisit it


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


[GitHub] [camel-quarkus] lburgazzoli commented on a change in pull request #226: Use MainSupport as base for running Camel

2019-10-04 Thread GitBox
lburgazzoli 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_r331369013
 
 

 ##
 File path: 
extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelSupport.java
 ##
 @@ -56,4 +69,67 @@ public static boolean isPublic(ClassInfo ci) {
 .flatMap(CamelSupport::safeWalk)
 .filter(Files::isRegularFile);
 }
+
+public static Stream getRouteBuilderClasses(IndexView view) {
+Set allKnownImplementors = new HashSet<>();
 
 Review comment:
   The problem is that the order also depends on how Jandex indexes entries so 
I'm not sure if it matter, maybe better is to have the RouteBuilder extends the 
Ordered interface and order them when routes are processed ?


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