jamesnetherton commented on a change in pull request #660: The MicroProfile 
test fails if message history is turned off
URL: https://github.com/apache/camel-quarkus/pull/660#discussion_r370078501
 
 

 ##########
 File path: 
extensions/microprofile-metrics/runtime/src/main/java/org/apache/camel/quarkus/component/microprofile/metrics/runtime/CamelMicroProfileMetricsRecorder.java
 ##########
 @@ -61,4 +63,24 @@ public void 
configureCamelContext(CamelMicroProfileMetricsConfig config,
             managementStrategy.addEventNotifier(new 
MicroProfileMetricsCamelContextEventNotifier());
         }
     }
+
+    private static class MicroProfileMetricsContextConfigurerListener extends 
MainListenerSupport {
+        private static final Logger LOGGER = 
Logger.getLogger(MicroProfileMetricsContextConfigurerListener.class);
+        private final CamelMicroProfileMetricsConfig config;
+
+        public 
MicroProfileMetricsContextConfigurerListener(CamelMicroProfileMetricsConfig 
config) {
+            this.config = config;
+        }
+
+        @Override
+        public void configure(CamelContext camelContext) {
+            if (camelContext.isMessageHistory() && 
config.enableMessageHistory) {
 
 Review comment:
   I wonder if we can simplify this to just:
   
   ```
   camelContext.setMessageHistory(true);
   camelContext.setMessageHistoryFactory(new 
MicroProfileMetricsMessageHistoryFactory());
   ```
   
   And not bother with the other checks? 
   
   In 3.1.0, when you add the `MessageHistoryFactory`, message history is [auto 
enabled](https://github.com/apache/camel/blob/f984a85ced885e0f8da58d3477b703d9cc2ff88c/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java#L3887)
 on the `CamelContext` anyway.

----------------------------------------------------------------
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