Search in sources :

Example 1 with PollableChannelManagement

use of org.springframework.integration.support.management.PollableChannelManagement in project spring-integration by spring-projects.

the class IntegrationManagementConfigurer method configureChannelMetrics.

@SuppressWarnings("unchecked")
private void configureChannelMetrics(String name, MessageChannelMetrics bean) {
    AbstractMessageChannelMetrics metrics;
    if (bean instanceof PollableChannelManagement) {
        metrics = this.metricsFactory.createPollableChannelMetrics(name);
    } else {
        metrics = this.metricsFactory.createChannelMetrics(name);
    }
    Assert.state(metrics != null, "'metrics' must not be null");
    ManagementOverrides overrides = bean.getOverrides();
    Boolean enabled = PatternMatchUtils.smartMatch(name, this.enabledCountsPatterns);
    if (enabled != null) {
        bean.setCountsEnabled(enabled);
    } else {
        if (!overrides.countsConfigured) {
            bean.setCountsEnabled(this.defaultCountsEnabled);
        }
    }
    enabled = PatternMatchUtils.smartMatch(name, this.enabledStatsPatterns);
    if (enabled != null) {
        bean.setStatsEnabled(enabled);
        metrics.setFullStatsEnabled(enabled);
    } else {
        if (!overrides.statsConfigured) {
            bean.setStatsEnabled(this.defaultStatsEnabled);
            metrics.setFullStatsEnabled(this.defaultStatsEnabled);
        }
    }
    if (bean instanceof ConfigurableMetricsAware && !overrides.metricsConfigured) {
        ((ConfigurableMetricsAware<AbstractMessageChannelMetrics>) bean).configureMetrics(metrics);
    }
    this.channelsByName.put(name, bean);
}
Also used : ConfigurableMetricsAware(org.springframework.integration.support.management.ConfigurableMetricsAware) AbstractMessageChannelMetrics(org.springframework.integration.support.management.AbstractMessageChannelMetrics) PollableChannelManagement(org.springframework.integration.support.management.PollableChannelManagement) ManagementOverrides(org.springframework.integration.support.management.IntegrationManagement.ManagementOverrides)

Aggregations

AbstractMessageChannelMetrics (org.springframework.integration.support.management.AbstractMessageChannelMetrics)1 ConfigurableMetricsAware (org.springframework.integration.support.management.ConfigurableMetricsAware)1 ManagementOverrides (org.springframework.integration.support.management.IntegrationManagement.ManagementOverrides)1 PollableChannelManagement (org.springframework.integration.support.management.PollableChannelManagement)1