You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2019/10/09 12:00:20 UTC
[camel-quarkus] branch master updated: chore: add some doc about
camel-main build steps
This is an automated email from the ASF dual-hosted git repository.
lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push:
new 1d047ca chore: add some doc about camel-main build steps
1d047ca is described below
commit 1d047caad133e53a24dbe55b309900d1ca60b3e5
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Wed Oct 9 12:36:35 2019 +0200
chore: add some doc about camel-main build steps
---
.../quarkus/core/deployment/BuildProcessor.java | 36 ++++++++++++++++------
1 file changed, 27 insertions(+), 9 deletions(-)
diff --git a/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java b/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java
index d7a77c4..fc759c1 100644
--- a/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java
+++ b/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java
@@ -151,6 +151,13 @@ class BuildProcessor {
beanProducer.produce(AdditionalBeanBuildItem.unremovableOf(CamelMainProducers.class));
}
+ /**
+ * This method is responsible to configure camel-main during static init phase which means
+ * discovering routes, listeners and services that need to be bound to the camel-main.
+ * <p>
+ * This method should not attempt to start or initialize camel-main as this need to be done
+ * at runtime.
+ */
@SuppressWarnings("unchecked")
@Record(ExecutionTime.STATIC_INIT)
@BuildStep(onlyIfNot = Flags.MainDisabled.class)
@@ -182,25 +189,36 @@ class BuildProcessor {
return new CamelMainBuildItem(main);
}
+ /**
+ * This method is responsible to start camel-main ar runtime.
+ *
+ * @param recorder the recorder.
+ * @param main a reference to a {@link CamelMain}.
+ * @param registry a reference to a {@link Registry}; note that this parameter is here as placeholder to
+ * ensure the {@link Registry} is fully configured before starting camel-main.
+ * @param executors the {@link org.apache.camel.spi.ReactiveExecutor} to be configured on camel-main, this
+ * happens during {@link ExecutionTime#RUNTIME_INIT} because the executor may need to start
+ * threads and so on. Note that we now expect a list of executors but that's because there is
+ * no way as of quarkus 0.23.x to have optional items.
+ * @param shutdown a reference to a {@link io.quarkus.runtime.ShutdownContext} used to register shutdown logic.
+ * @param startList a placeholder to ensure camel-main start after the ArC container is fully initialized. This
+ * is required as under the hoods the camel registry may look-up beans form the
+ * container thus we need it to be fully initialized to avoid unexpected behaviors.
+ */
@Record(ExecutionTime.RUNTIME_INIT)
@BuildStep(onlyIfNot = Flags.MainDisabled.class)
void start(
CamelMainRecorder recorder,
CamelMainBuildItem main,
- // TODO: keep this as placeholder to ensure the registry is fully configured
- // before starting the camel context
CamelRuntimeRegistryBuildItem registry,
- // TODO: replace with @Overridable
- List<CamelReactiveExecutorBuildItem> reactiveExecutors,
+ List<CamelReactiveExecutorBuildItem> executors, // TODO: replace with @Overridable
ShutdownContextBuildItem shutdown,
- // TODO: keep this list as placeholder to ensure the ArC container is fully
- // started before starting main
List<ServiceStartBuildItem> startList) {
- if (reactiveExecutors.size() > 1) {
+ if (executors.size() > 1) {
throw new IllegalArgumentException("Detected multiple reactive executors");
- } else if (reactiveExecutors.size() == 1) {
- recorder.setReactiveExecutor(main.getInstance(), reactiveExecutors.get(0).getInstance());
+ } else if (executors.size() == 1) {
+ recorder.setReactiveExecutor(main.getInstance(), executors.get(0).getInstance());
}
recorder.start(shutdown, main.getInstance());