List of usage examples for org.springframework.integration.context IntegrationContextUtils INTEGRATION_MESSAGE_HISTORY_CONFIGURER_BEAN_NAME
String INTEGRATION_MESSAGE_HISTORY_CONFIGURER_BEAN_NAME
To view the source code for org.springframework.integration.context IntegrationContextUtils INTEGRATION_MESSAGE_HISTORY_CONFIGURER_BEAN_NAME.
Click Source Link
From source file:hello.MetricsActivator.java
@Override public void afterSingletonsInstantiated() { Map<String, MessageHandlerMetrics> messageHandlers = this.applicationContext .getBeansOfType(MessageHandlerMetrics.class); for (Entry<String, MessageHandlerMetrics> entry : messageHandlers.entrySet()) { String beanName = entry.getKey(); MessageHandlerMetrics bean = entry.getValue(); if (this.handlerInAnonymousWrapper(bean) != null) { if (logger.isDebugEnabled()) { logger.debug("Skipping " + beanName + " because it wraps another handler"); }/* w ww . j a va2s . com*/ continue; } // If the handler is proxied, we have to extract the target to expose as an MBean. // The MetadataMBeanInfoAssembler does not support JDK dynamic proxies. MessageHandlerMetrics monitor = (MessageHandlerMetrics) extractTarget(bean); this.handlers.add(monitor); } Map<String, MessageSourceMetrics> messageSources = this.applicationContext .getBeansOfType(MessageSourceMetrics.class); for (Entry<String, MessageSourceMetrics> entry : messageSources.entrySet()) { // If the source is proxied, we have to extract the target to expose as an MBean. // The MetadataMBeanInfoAssembler does not support JDK dynamic proxies. MessageSourceMetrics monitor = (MessageSourceMetrics) extractTarget(entry.getValue()); this.sources.add(monitor); } Map<String, MessageChannelMetrics> messageChannels = this.applicationContext .getBeansOfType(MessageChannelMetrics.class); for (Entry<String, MessageChannelMetrics> entry : messageChannels.entrySet()) { // If the channel is proxied, we have to extract the target to expose as an MBean. // The MetadataMBeanInfoAssembler does not support JDK dynamic proxies. MessageChannelMetrics monitor = (MessageChannelMetrics) extractTarget(entry.getValue()); this.channels.add(monitor); } Map<String, MessageProducer> messageProducers = this.applicationContext .getBeansOfType(MessageProducer.class); for (Entry<String, MessageProducer> entry : messageProducers.entrySet()) { MessageProducer messageProducer = entry.getValue(); if (messageProducer instanceof Lifecycle) { Lifecycle target = (Lifecycle) extractTarget(messageProducer); if (!(target instanceof AbstractMessageProducingHandler)) { this.inboundLifecycleMessageProducers.add(target); } } } super.afterSingletonsInstantiated(); try { for (Map.Entry<String, MessageChannelMetrics> entry : registerChannels(this.channels).entrySet()) { //super.registerBeanNameOrInstance(entry.getValue(), entry.getKey()); } for (Map.Entry<String, MessageHandlerMetrics> entry : registerHandlers(this.handlers).entrySet()) { //super.registerBeanNameOrInstance(entry.getValue(), entry.getKey()); } for (Map.Entry<String, MessageSourceMetrics> entry : registerSources(this.sources).entrySet()) { //super.registerBeanNameOrInstance(entry.getValue(), entry.getKey()); } for (Map.Entry<String, AbstractEndpoint> entry : registerEndpoints().entrySet()) { //ObjectName objectName = registerBeanInstance(new ManagedEndpoint(entry.getValue()), entry.getKey()); //logger.info("Registered endpoint without MessageSource: " + objectName); } if (this.applicationContext .containsBean(IntegrationContextUtils.INTEGRATION_MESSAGE_HISTORY_CONFIGURER_BEAN_NAME)) { Object messageHistoryConfigurer = this.applicationContext .getBean(IntegrationContextUtils.INTEGRATION_MESSAGE_HISTORY_CONFIGURER_BEAN_NAME); if (messageHistoryConfigurer instanceof MessageHistoryConfigurer) { registerBeanInstance(messageHistoryConfigurer, IntegrationContextUtils.INTEGRATION_MESSAGE_HISTORY_CONFIGURER_BEAN_NAME); } } } catch (RuntimeException e) { unregisterBeans(); throw e; } }