Example usage for org.springframework.integration.config IntegrationConfigUtils autoCreateDirectChannel

List of usage examples for org.springframework.integration.config IntegrationConfigUtils autoCreateDirectChannel

Introduction

In this page you can find the example usage for org.springframework.integration.config IntegrationConfigUtils autoCreateDirectChannel.

Prototype

public static void autoCreateDirectChannel(String channelName, BeanDefinitionRegistry registry) 

Source Link

Usage

From source file:org.springframework.integration.config.ChannelInitializer.java

@Override
public void afterPropertiesSet() throws Exception {
    Assert.notNull(this.beanFactory, "'beanFactory' must not be null");
    if (!this.autoCreate) {
        return;/*  w w  w  .jav a 2  s .  c  om*/
    } else {
        AutoCreateCandidatesCollector channelCandidatesCollector = this.beanFactory.getBean(
                IntegrationContextUtils.AUTO_CREATE_CHANNEL_CANDIDATES_BEAN_NAME,
                AutoCreateCandidatesCollector.class);
        Assert.notNull(channelCandidatesCollector,
                "Failed to locate '" + IntegrationContextUtils.AUTO_CREATE_CHANNEL_CANDIDATES_BEAN_NAME);
        // at this point channelNames are all resolved with placeholders and SpEL
        Collection<String> channelNames = channelCandidatesCollector.getChannelNames();
        if (channelNames != null) {
            for (String channelName : channelNames) {
                if (!this.beanFactory.containsBean(channelName)) {
                    if (this.logger.isDebugEnabled()) {
                        this.logger.debug("Auto-creating channel '" + channelName + "' as DirectChannel");
                    }
                    IntegrationConfigUtils.autoCreateDirectChannel(channelName,
                            (BeanDefinitionRegistry) this.beanFactory);
                }
            }
        }
    }
}