jamesnetherton commented on a change in pull request #3151:
URL: https://github.com/apache/camel-quarkus/pull/3151#discussion_r721951657
##########
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:
I tweaked things a bit to obtain an instance of the observed event class
and then use it to get the simple name. Hopefully that's acceptable.
I also added some comments explaining why simple name is used.
--
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]