From f82c40fd3aa1c2116e74ec81b8645e559dc96359 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Thu, 10 Mar 2011 10:28:08 -0500 Subject: [PATCH] INT-1816 chahnged NotificationPublishingMessageHandler to select the IntegrationMBeanExporter over MBeanExporter if available --- .../jmx/NotificationPublishingMessageHandler.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/NotificationPublishingMessageHandler.java b/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/NotificationPublishingMessageHandler.java index 32e8a2619e..cee1635208 100644 --- a/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/NotificationPublishingMessageHandler.java +++ b/spring-integration-jmx/src/main/java/org/springframework/integration/jmx/NotificationPublishingMessageHandler.java @@ -29,6 +29,7 @@ import org.springframework.beans.factory.ListableBeanFactory; import org.springframework.integration.Message; import org.springframework.integration.handler.AbstractMessageHandler; import org.springframework.integration.mapping.OutboundMessageMapper; +import org.springframework.integration.monitor.IntegrationMBeanExporter; import org.springframework.jmx.export.MBeanExporter; import org.springframework.jmx.export.annotation.ManagedResource; import org.springframework.jmx.export.notification.NotificationPublisher; @@ -95,7 +96,13 @@ public class NotificationPublishingMessageHandler extends AbstractMessageHandler Assert.isTrue(exporters.size() > 0, "No MBeanExporter is available in the current context (found " + exporters.size() + ")."); - MBeanExporter exporter = exporters.values().iterator().next(); + MBeanExporter exporter = null; + for (MBeanExporter exp : exporters.values()) { + exporter = exp; + if (exporter instanceof IntegrationMBeanExporter){ + break; + } + } if (this.notificationMapper == null) { this.notificationMapper = new DefaultNotificationMapper(this.objectName, this.defaultNotificationType); }