final Set<String> sources = agentConf.getSourceSet();
final Map<String, ComponentConfiguration> compMap = agentConf.getSourceConfigMap();
for (final String sourceName : sources) {
final ComponentConfiguration comp = compMap.get(sourceName);
if (comp != null) {
final SourceConfiguration config = (SourceConfiguration) comp;
final Source source = sourceFactory.create(comp.getComponentName(), comp.getType());
Configurables.configure(source, config);
final Set<String> channelNames = config.getChannels();
final List<Channel> channels = new ArrayList<Channel>();
for (final String chName : channelNames) {
channels.add(conf.getChannels().get(chName));
}
final ChannelSelectorConfiguration selectorConfig = config.getSelectorConfiguration();
final ChannelSelector selector = ChannelSelectorFactory.create(channels, selectorConfig);
final ChannelProcessor channelProcessor = new ChannelProcessor(selector);
Configurables.configure(channelProcessor, config);