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<CamelBeanBuildItem> camelBeans,
-            BuildProducer<RuntimeBeanBuildItem> runtimeBeans) {
+            List<CamelBeanBuildItem> registryItems) {
 
-        RuntimeRegistry registry = new RuntimeRegistry();
-        RuntimeValue<CamelRuntime> camelRuntime = recorder.create(registry);
+        RuntimeValue<Registry> 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<BeanContainerListenerBuildItem> 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

Reply via email to