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

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

 ##
 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:
   Yes, sorry, of course, that would be a valid reason to reject my proposal. 


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 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:
   I'd personaly vote for discontinuing the bad practice now and eventually 
rename the other props later.


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 File path: integration-tests/bean/pom.xml
 ##
 @@ -30,6 +30,10 @@
 Integration tests for Camel Bean extension
 
 
+
+org.apache.camel.quarkus
+camel-quarkus-core
 
 Review comment:
   Core is redundant here, isn't it? And similarly in other itests.


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 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:
   I'd generally vote for using non-negated names, e.g. `mainEnabled` in this 
case. I find them easier to decipher, esp. when used with a negator. 


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 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:
   This could eventually also get un-negated.


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 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:
   RuntimeBeanRepository being the only caller of BeanManagerHelper, is there a 
reason to keep them separate? I mean the invocations of BeanManagerHelper could 
be inlined here. 


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 File path: integration-tests/aws/pom.xml
 ##
 @@ -30,6 +30,10 @@
 The camel integration tests
 
 
+
+org.apache.camel.quarkus
+camel-quarkus-main
+
 
 Review comment:
   I am trying to understand the significance of this. In case this is meant to 
be a speciality for <20% of users, then I think we should figure out how not 
confuse the rest 80% of the users.


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 File path: integration-tests/aws/pom.xml
 ##
 @@ -30,6 +30,10 @@
 The camel integration tests
 
 
+
+org.apache.camel.quarkus
+camel-quarkus-main
+
 
 Review comment:
   Do you need this in Camel K? Do you think 80+% of Camel Quarkus users will 
need this?


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

2019-10-04 Thread GitBox
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 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:
   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 on 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


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

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


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

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

 ##
 File path: integration-tests/aws/pom.xml
 ##
 @@ -30,6 +30,10 @@
 The camel integration tests
 
 
+
+org.apache.camel.quarkus
+camel-quarkus-main
+
 
 Review comment:
   What are the potential use cases for creating one's own "mains"?


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 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:
   Thanks, makes sense. How about adding a class level JavaDoc something like 
`Produces BuildItems from the io.quarkus.deployment.builditem.substrate 
package` ?


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 File path: 
extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/runtime/support/BeanManagerHelper.java
 ##
 @@ -27,25 +27,35 @@
 import javax.enterprise.inject.spi.BeanManager;
 
 import io.quarkus.arc.Arc;
+import io.quarkus.arc.ArcContainer;
 
+/**
+ * Helper methods retrieve beans from the {@link Arc} container.
 
 Review comment:
   ... methods _to_ retrieve ... maybe?


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 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:
   There is `org.apache.camel.quarkus.main.deployment.BuildProcessor` and 
`org.apache.camel.quarkus.main.deployment.SubstrateProcessor`. Both contain 
build steps and it is not clear to me what would be the criteria to decide for 
the current and future build steps into which one they belong? 


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 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:
   Sorry I meant static init vs. runtime init. It matters for the kinds of 
resources available inside the method and it gives a hint about ordering. Of 
course, the info can be looked up in the IDE, but when in a comment, it helps 
to faster understand 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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 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:
   There is `org.apache.camel.quarkus.main.deployment.BuildProcessor` and 
`org.apache.camel.quarkus.main.deployment.SubstrateProcessor`. Both contain 
build steps and it is not clear to me what would be the criteria to decide for 
the current and future build steps to decide into which one they belong? 


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 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:
   Why do we have to do this manually now?


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 File path: 
extensions/main/runtime/src/main/java/org/apache/camel/quarkus/main/CamelMainEvents.java
 ##
 @@ -14,8 +14,24 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.core.runtime;
+package org.apache.camel.quarkus.main;
 
-public class InitializingEvent {
+public final class CamelMainEvents {
 
 Review comment:
   Each of this events should be documented: 
   
   * Who is firing it?
   * Start/Stop of what?
   * Any other the users should know?


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 File path: integration-tests/pom.xml
 ##
 @@ -80,7 +80,8 @@
 
 core
 core-impl
-core-cdi
+
 
 Review comment:
   This commented line can perhaps be removed?


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 File path: 
extensions/main/deployment/src/main/java/org/apache/camel/quarkus/main/deployment/support/CamelMainListenerBuildItem.java
 ##
 @@ -0,0 +1,32 @@
+/*
+ * 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.MultiBuildItem;
+import org.apache.camel.main.MainListener;
+
+public final class CamelMainListenerBuildItem extends MultiBuildItem {
 
 Review comment:
   ```suggestion
   /**
* A {@link MultiBuildItem} holding {@link MainListener}s to add to {@link 
CamelMain}.
*/
   public final class CamelMainListenerBuildItem extends MultiBuildItem {
   ```


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 File path: 
extensions/main/runtime/src/main/java/org/apache/camel/quarkus/main/CamelMainRecorder.java
 ##
 @@ -0,0 +1,84 @@
+/*
+ * 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;
+
+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.CamelContext;
+import org.apache.camel.main.MainListener;
+
+@Recorder
+public class CamelMainRecorder {
+public RuntimeValue create(RuntimeValue runtime, 
BeanContainer container) {
 
 Review comment:
   I vote for renaming to `createCamelMain`


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 File path: 
extensions/main/runtime/src/main/java/org/apache/camel/quarkus/main/CamelMainRecorder.java
 ##
 @@ -0,0 +1,84 @@
+/*
+ * 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;
+
+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.CamelContext;
+import org.apache.camel.main.MainListener;
+
+@Recorder
+public class CamelMainRecorder {
+public RuntimeValue create(RuntimeValue runtime, 
BeanContainer container) {
+CamelMain main = new CamelMain();
+main.setCamelContext(runtime.getValue());
+main.disableHangupSupport();
+main.addMainListener(new CamelMainEventDispatcher());
+
+// register to the container
+container.instance(CamelMainProducers.class).setMain(main);
+
+return new RuntimeValue<>(main);
+}
+
+public void addRouteBuilder(
+RuntimeValue main,
+String className) {
+try {
+main.getValue().addRouteBuilder(Class.forName(className));
+} catch (Exception e) {
+throw new RuntimeException(e);
 
 Review comment:
   ```suggestion
   throw new RuntimeException("Could not add route builder '" + 
className + "'", e);
   ```
   
   Might produce a more useful message in case there is a problem with a 
specific route builder out of many.


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 File path: 
extensions/main/runtime/src/main/java/org/apache/camel/quarkus/main/CamelMainEvents.java
 ##
 @@ -14,8 +14,24 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.core.runtime;
+package org.apache.camel.quarkus.main;
 
-public class InitializingEvent {
+public final class CamelMainEvents {
+private CamelMainEvents() {
+}
 
+public static class BeforeStart {
+}
+
+public static class Configure {
+}
+
+public static class AsfterStart {
+}
+
+public static class BeforeStop {
+}
+
+public static class AsfterStop {
 
 Review comment:
   `s/AsfterStop/AfterStop/`


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 File path: integration-tests/aws/pom.xml
 ##
 @@ -30,6 +30,10 @@
 The camel integration tests
 
 
+
+org.apache.camel.quarkus
+camel-quarkus-main
+
 
 Review comment:
   Do we really want end users to have to depend on `camel-quarkus-main` 
directly in addition to the endpoint extensions they want to use? It 
spontaneously looks like an unnecessary complication to me. Shouldn't our 
endpoint extensions better depend on `camel-quarkus-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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 File path: 
extensions/main/runtime/src/main/java/org/apache/camel/quarkus/main/CamelMainRecorder.java
 ##
 @@ -0,0 +1,84 @@
+/*
+ * 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;
+
+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.CamelContext;
+import org.apache.camel.main.MainListener;
+
+@Recorder
+public class CamelMainRecorder {
+public RuntimeValue create(RuntimeValue runtime, 
BeanContainer container) {
+CamelMain main = new CamelMain();
+main.setCamelContext(runtime.getValue());
+main.disableHangupSupport();
+main.addMainListener(new CamelMainEventDispatcher());
+
+// register to the container
+container.instance(CamelMainProducers.class).setMain(main);
+
+return new RuntimeValue<>(main);
+}
+
+public void addRouteBuilder(
+RuntimeValue main,
+String className) {
+try {
+main.getValue().addRouteBuilder(Class.forName(className));
+} catch (Exception e) {
+throw new RuntimeException(e);
+}
+}
+
+public void addListener(RuntimeValue main, MainListener 
listener) {
+main.getValue().addMainListener(listener);
+}
+
+public void start(ShutdownContext shutdown, RuntimeValue main) {
+shutdown.addShutdownTask(new Runnable() {
+@Override
+public void run() {
+try {
+main.getValue().stop();
+} catch (Exception e) {
+throw new RuntimeException(e);
+}
+}
+});
+
+try {
+main.getValue().init();
+main.getValue().start();
+} catch (Exception e) {
+throw new RuntimeException(e);
+}
+}
+
+public Supplier mainSupplier(RuntimeValue main) {
 
 Review comment:
   What is the purpose of this method? I do not see it used anywhere. 


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 File path: 
integration-tests/main/runtime/src/main/java/org/apache/camel/quarkus/main/support/SupportRecorder.java
 ##
 @@ -14,8 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.core.runtime;
+package org.apache.camel.quarkus.main.support;
 
-public class StartingEvent {
+import io.quarkus.runtime.annotations.Recorder;
 
+@Recorder
+public class SupportRecorder {
 
 Review comment:
   It looks like this class can be removed?


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 File path: 
extensions/main/runtime/src/main/java/org/apache/camel/quarkus/main/CamelMainProducers.java
 ##
 @@ -0,0 +1,35 @@
+/*
+ * 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;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Singleton;
+
+@Singleton
+public class CamelMainProducers {
+private CamelMain main;
 
 Review comment:
   `volatile` maybe?


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 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
 
 Review comment:
   ```suggestion
   /**
* Producers of beans that are injectable via CDI.
*/
   @Singleton
   ```


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 File path: 
extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java
 ##
 @@ -67,151 +47,57 @@
 
 @Record(ExecutionTime.STATIC_INIT)
 @BuildStep
-CamelRuntimeBuildItem create(
+CamelRegistryBuildItem registry(
 CamelRecorder recorder,
-List camelBeans,
-BuildProducer runtimeBeans) {
+List registryItems) {
 
-RuntimeRegistry registry = new RuntimeRegistry();
-RuntimeValue camelRuntime = recorder.create(registry);
+RuntimeValue registry = recorder.createRegistry();
 
-getBuildTimeRouteBuilderClasses().forEach(
-b -> recorder.addBuilder(camelRuntime, b)
-);
-
-services().filter(
-si -> camelBeans.stream().noneMatch(
+CamelSupport.services(applicationArchivesBuildItem).filter(
+si -> registryItems.stream().noneMatch(
 c -> Objects.equals(si.name, c.getName()) && 
c.getType().isAssignableFrom(si.type)
 )
 ).forEach(
 si -> {
 LOGGER.debug("Binding camel service {} with type {}", si.name, 
si.type);
 
 recorder.bind(
-camelRuntime,
+registry,
 si.name,
 si.type
 );
 }
 );
 
-for (CamelBeanBuildItem item: camelBeans) {
+for (CamelBeanBuildItem item: registryItems) {
 LOGGER.debug("Binding item with name: {}, type {}", 
item.getName(), item.getType());
 
 recorder.bind(
-camelRuntime,
+registry,
 item.getName(),
 item.getType(),
 item.getValue()
 );
 }
 
-
runtimeBeans.produce(RuntimeBeanBuildItem.builder(CamelRuntime.class).setRuntimeValue(camelRuntime).build());
-
-return new CamelRuntimeBuildItem(camelRuntime);
+return new CamelRegistryBuildItem(registry);
 }
 
 @Record(ExecutionTime.STATIC_INIT)
 @BuildStep
-AdditionalBeanBuildItem createProducers(
-CamelRuntimeBuildItem runtime,
+CamelContextBuildItem context(
 CamelRecorder recorder,
-BuildProducer listeners) {
-
-listeners.produce(new 
BeanContainerListenerBuildItem(recorder.initRuntimeInjection(runtime.getRuntime(;
-
-return AdditionalBeanBuildItem.unremovableOf(CamelProducers.class);
-}
-
-@Record(ExecutionTime.STATIC_INIT)
-@BuildStep
-void init(
-// TODO: keep this field as we need to be sure ArC is initialized 
before starting events
-//   We need to re-evaluate the need of fire events from 
context once doing
-//   https://github.com/apache/camel-quarkus/issues/9
+CamelRegistryBuildItem registry,
+// TODO: this add a dependency on Arc
 BeanContainerBuildItem beanContainerBuildItem,
 
 Review comment:
   I like that you use the param names without the `BuildItem` suffix 
elsewhere. You may want to rename also `beanContainerBuildItem` when you go 
around next time.


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 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:
   ```suggestion
   /**
* Holds the {@link CamelMain} {@link RuntimeValue}.
*/
   public final class CamelMainBuildItem extends SimpleBuildItem {
   ```


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 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);
+}
+
+private static List services(Path p) {
+List answer = new ArrayList<>();
+
+String name = p.getFileName().toString();
+try (InputStream is = Files.newInputStream(p)) {
+Properties props = new Properties();
+props.load(is);
+for (Map.Entry entry : props.entrySet()) {
+String k = entry.getKey().toString();
+if (k.equals("class")) {
+String clazz = entry.getValue().toString();
+Class cl = Class.forName(clazz);
+
+answer.add(new ServiceInfo(name, cl));
+}
+}
+} catch (Exception e) {
+throw new RuntimeException(e);
+}
+
+return answer;
+}
+
+public static class ServiceInfo {
 
 Review comment:
   JavaDoc please. A noun phrase would be enoungh. Something like `A 
description/metadata/identifier? of a Camel Service (typically found in {@code 
META-INF/services/org/apache/camel} of a jar?)`


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 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:
   IRC, CDI does not care for synchronization in any way. Shouldn't this be 
`volatile`?


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 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:
   Minor: Do these two BuildItem classes deserve a separate package (with a 
meaningless `support` last segment name?)


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 File path: 
extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelContextBuildItem.java
 ##
 @@ -16,19 +16,19 @@
  */
 package org.apache.camel.quarkus.core.deployment;
 
+
 import io.quarkus.builder.item.SimpleBuildItem;
 import io.quarkus.runtime.RuntimeValue;
-import org.apache.camel.quarkus.core.runtime.CamelRuntime;
-
-public final class CamelRuntimeBuildItem extends SimpleBuildItem {
+import org.apache.camel.CamelContext;
 
-private final RuntimeValue runtime;
+public final class CamelContextBuildItem extends SimpleBuildItem {
 
 Review comment:
   ```suggestion
   /**
* Holds the {@link CamelContext} {@link RuntimeValue}.
*/
   public final class CamelContextBuildItem extends SimpleBuildItem {
   ```


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 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:
   Why do we need two Processors? It would be nice to figure out from JavaDoc 
which tasks belong where.


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 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:
   A JavaDoc stating whether this is a invoked from a build time or a runtime 
BuildStep would be nice.


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 File path: 
extensions/main/deployment/src/main/java/org/apache/camel/quarkus/main/deployment/BuildProcessor.java
 ##
 @@ -0,0 +1,80 @@
+/*
+ * 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 java.util.List;
+
+import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
+import io.quarkus.arc.deployment.BeanContainerBuildItem;
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.annotations.ExecutionTime;
+import io.quarkus.deployment.annotations.Record;
+import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
+import io.quarkus.deployment.builditem.ServiceStartBuildItem;
+import io.quarkus.deployment.builditem.ShutdownContextBuildItem;
+import io.quarkus.runtime.RuntimeValue;
+import org.apache.camel.quarkus.core.deployment.CamelContextBuildItem;
+import org.apache.camel.quarkus.core.deployment.CamelSupport;
+import org.apache.camel.quarkus.main.CamelMain;
+import org.apache.camel.quarkus.main.CamelMainProducers;
+import org.apache.camel.quarkus.main.CamelMainRecorder;
+import org.apache.camel.quarkus.main.deployment.support.CamelMainBuildItem;
+import 
org.apache.camel.quarkus.main.deployment.support.CamelMainListenerBuildItem;
+
+public class BuildProcessor {
+@BuildStep
+void beans(BuildProducer beanProducer) {
+
beanProducer.produce(AdditionalBeanBuildItem.unremovableOf(CamelMainProducers.class));
+}
+
+@Record(ExecutionTime.STATIC_INIT)
+@BuildStep
+CamelMainBuildItem create(
+CombinedIndexBuildItem combinedIndexBuildItem,
+CamelMainRecorder recorder,
+CamelContextBuildItem context,
+List listeners,
+// TODO: keep is as it adds a dependency on Arc
 
 Review comment:
   It would be nice to document why is the dependency on Arc important, e.g. to 
be able to decide in the future that the param is not needed 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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 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:
   +1 For deterministic ordering that makes issues reproducible. 


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 File path: 
extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java
 ##
 @@ -67,151 +47,57 @@
 
 @Record(ExecutionTime.STATIC_INIT)
 @BuildStep
-CamelRuntimeBuildItem create(
+CamelRegistryBuildItem registry(
 
 Review comment:
   +1 for having a separate RegistryBuildItem


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 File path: 
extensions/main/runtime/src/main/java/org/apache/camel/quarkus/main/CamelMainEventDispatcher.java
 ##
 @@ -0,0 +1,52 @@
+/*
+ * 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;
+
+import io.quarkus.arc.Arc;
+import org.apache.camel.CamelContext;
+import org.apache.camel.main.MainSupport;
+
+public class CamelMainEventDispatcher implements 
org.apache.camel.main.MainListener {
 
 Review comment:
   Please a single sentence summary JavaDoc what is this class doing.


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 File path: 
extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/runtime/support/BeanManagerHelper.java
 ##
 @@ -27,6 +27,7 @@
 import javax.enterprise.inject.spi.BeanManager;
 
 import io.quarkus.arc.Arc;
+import io.quarkus.arc.ArcContainer;
 
 @Vetoed
 
 Review comment:
   ```suggestion
   /**
* Helper methods to map {@link Registry} calls to {@link Arc}.
*/
   @Vetoed
   ```


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 File path: 
extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelSupport.java
 ##
 @@ -18,13 +18,26 @@
 
 import java.io.IOError;
 import java.io.IOException;
+import java.io.InputStream;
 import java.lang.reflect.Modifier;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
 import java.util.stream.Stream;
 
 import io.quarkus.deployment.builditem.ApplicationArchivesBuildItem;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.AdviceWithRouteBuilder;
+import org.apache.camel.builder.RouteBuilder;
 import org.jboss.jandex.ClassInfo;
+import org.jboss.jandex.DotName;
+import org.jboss.jandex.IndexView;
 
 public final class CamelSupport {
 
 Review comment:
   A minimal JavaDoc stating the purpose of this class would be nice. 
   
   If the public methods are supposed to be usable by other extensions, they 
should get a minimal JavaDoc too. 
   Those ones not supposed to be publicly usable should not be public (but a 
single sentence describing the contract and behavior would still be nice, 
although it is much less important for private and package-visible methods).


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] ppalaga commented on a change in pull request #226: Use MainSupport as base for running Camel

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

 ##
 File path: 
extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelRegistryBuildItem.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.core.deployment;
+
+import io.quarkus.builder.item.SimpleBuildItem;
+import io.quarkus.runtime.RuntimeValue;
+import org.apache.camel.spi.Registry;
+
+public final class CamelRegistryBuildItem extends SimpleBuildItem {
 
 Review comment:
   ```suggestion
   /**
* Holds the {@link Registry} {@link RuntimeValue}.
*/
   public final class CamelRegistryBuildItem extends SimpleBuildItem {
   ```


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