ppalaga commented on a change in pull request #3151:
URL: https://github.com/apache/camel-quarkus/pull/3151#discussion_r721693213
##########
File path:
extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelContextProcessor.java
##########
@@ -163,4 +168,50 @@ public CamelRuntimeBuildItem runtime(
recorder.createRuntime(beanContainer.getValue(),
context.getCamelContext()),
config.bootstrap.enabled);
}
+
+ /**
+ * Registers Camel CDI event bridges if
quarkus.camel.event-bridge.enabled=true and if
+ * the relevant events have CDI observers configured for them.
+ *
+ * @param beanDiscovery build item containing the results of bean discovery
+ * @param context build item containing the CamelContext instance
+ * @param recorder the CamelContext recorder instance
+ */
+ @Record(ExecutionTime.STATIC_INIT)
+ @BuildStep(onlyIf = EventBridgeEnabled.class)
+ public void registerCamelEventBridges(
+ BeanDiscoveryFinishedBuildItem beanDiscovery,
+ CamelContextBuildItem context,
+ CamelContextRecorder recorder) {
+
+ Set<String> observedLifecycleEvents = beanDiscovery.getObservers()
+ .stream()
+ .map(observerInfo ->
observerInfo.getObservedType().name().toString())
+ .filter(observedType ->
observedType.startsWith("org.apache.camel.quarkus.core.events"))
+
.collect(Collectors.collectingAndThen(Collectors.toUnmodifiableSet(),
HashSet::new));
+
+ Set<String> observedManagementEvents = beanDiscovery.getObservers()
+ .stream()
+ .filter(observerInfo ->
observerInfo.getObservedType().name().toString()
+ .matches("org.apache.camel(?!.quarkus).*Event$"))
+ .map(observerInfo ->
observerInfo.getObservedType().name().local())
Review comment:
OK, thanks, now I see that matching on simple name allows to generalize
from interface name in the handler (build time) declaration to an impl class
name when filtering at runtime.
The more I think `DotName.local()` is not what we need. `myDotName.local()`
returns the simple name `MyClass` only if `myDotName` was created via
`Dotname.createComponentized("org.myorg.ns", "MyClass")`.
But that's not the only option. If it was created via
`Dotname.createSimple("org.myorg.ns.MyClass")` then `local()` returns the whole
`"org.myorg.ns.MyClass"`.
Because we never know how the supplied DotNames got created, we can never
know whether `local()` returns a simple name or a FQ 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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]