You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2024/03/28 14:12:38 UTC

(camel-spring-boot) branch main updated: camel-micrometer - Fix potential issue with CamelContext not being set causing NPE

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git


The following commit(s) were added to refs/heads/main by this push:
     new 13961313fe0 camel-micrometer - Fix potential issue with CamelContext not being set causing NPE
13961313fe0 is described below

commit 13961313fe0df4c8c10209deecc4667607af0dc6
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Mar 28 15:12:26 2024 +0100

    camel-micrometer - Fix potential issue with CamelContext not being set causing NPE
---
 .../micrometer/springboot/metrics/CamelMetricsAutoConfiguration.java  | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/components-starter/camel-micrometer-starter/src/main/java/org/apache/camel/component/micrometer/springboot/metrics/CamelMetricsAutoConfiguration.java b/components-starter/camel-micrometer-starter/src/main/java/org/apache/camel/component/micrometer/springboot/metrics/CamelMetricsAutoConfiguration.java
index 67e3c623ce0..ac7f7b6c543 100644
--- a/components-starter/camel-micrometer-starter/src/main/java/org/apache/camel/component/micrometer/springboot/metrics/CamelMetricsAutoConfiguration.java
+++ b/components-starter/camel-micrometer-starter/src/main/java/org/apache/camel/component/micrometer/springboot/metrics/CamelMetricsAutoConfiguration.java
@@ -49,6 +49,7 @@ public class CamelMetricsAutoConfiguration {
             MeterRegistry meterRegistry) {
         if (configuration.isEnableRoutePolicy()) {
             MicrometerRoutePolicyFactory factory = new MicrometerRoutePolicyFactory();
+            factory.setCamelContext(camelContext);
             factory.setMeterRegistry(meterRegistry);
             if ("legacy".equalsIgnoreCase(configuration.getNamingStrategy())) {
                 factory.setNamingStrategy(MicrometerRoutePolicyNamingStrategy.LEGACY);
@@ -69,6 +70,7 @@ public class CamelMetricsAutoConfiguration {
         ManagementStrategy managementStrategy = camelContext.getManagementStrategy();
         if (configuration.isEnableExchangeEventNotifier()) {
             MicrometerExchangeEventNotifier notifier = new MicrometerExchangeEventNotifier();
+            notifier.setCamelContext(camelContext);
             notifier.setMeterRegistry(meterRegistry);
             if ("legacy".equalsIgnoreCase(configuration.getNamingStrategy())) {
                 notifier.setNamingStrategy(MicrometerExchangeEventNotifierNamingStrategy.LEGACY);
@@ -78,6 +80,7 @@ public class CamelMetricsAutoConfiguration {
 
         if (configuration.isEnableRouteEventNotifier()) {
             MicrometerRouteEventNotifier notifier = new MicrometerRouteEventNotifier();
+            notifier.setCamelContext(camelContext);
             notifier.setMeterRegistry(meterRegistry);
             if ("legacy".equalsIgnoreCase(configuration.getNamingStrategy())) {
                 notifier.setNamingStrategy(MicrometerRouteEventNotifierNamingStrategy.LEGACY);
@@ -90,6 +93,7 @@ public class CamelMetricsAutoConfiguration {
                 camelContext.setMessageHistory(true);
             }
             MicrometerMessageHistoryFactory factory = new MicrometerMessageHistoryFactory();
+            factory.setCamelContext(camelContext);
             factory.setMeterRegistry(meterRegistry);
             if ("legacy".equalsIgnoreCase(configuration.getNamingStrategy())) {
                 factory.setNamingStrategy(MicrometerMessageHistoryNamingStrategy.LEGACY);