AddProcessingUnit() 공개 메소드

public AddProcessingUnit ( string key, ProcessingUnit unit ) : void
key string
unit ProcessingUnit
리턴 void
        public static ProcessingUnitHost FromConfiguration(MessagePipelineSection configuration)
        {
            ProcessingUnitHost host = new ProcessingUnitHost();
            Dictionary<string,IChannel> mChannelLookup = new Dictionary<string,IChannel>();
            for (int i = 0; i < configuration.Pipelines.Count; i++)
            {
                for (int j = 0; j < configuration.Pipelines[i].Channels.Count; j++)
                {
                    var channel = configuration.Pipelines[i].Channels[j];
                    if (channel.Scheme != "sb")
                        throw new NotImplementedException("Schemes other than 'sb' are not supported.");
                    //TODO: this is not nice... other/better way to do injection (support custom implementation)
                    mChannelLookup.Add(channel.Name, (IChannel)Activator.CreateInstance
                    (Type.GetType("IntegrationPatterns.ServiceBus.Channel, IntegrationPatterns.ServiceBus"),
                     channel.Name));

                }
                for (int j = 0; j < configuration.Pipelines[i].ProcessingUnits.Count; j++)
                {
                    var config = configuration.Pipelines[i].ProcessingUnits[j];
                    var unit = Activator.CreateInstance(Type.GetType(config.UnitType));
                    fixChannelReferences(((ProcessingUnit)unit).InputChannels, config.Inputs, mChannelLookup);
                    fixChannelReferences(((ProcessingUnit)unit).OutputChannels, config.Outputs, mChannelLookup);
                    fixChannelReferences(((ProcessingUnit)unit).ControlChannels, config.Controls, mChannelLookup);
                    host.AddProcessingUnit(config.Name, (ProcessingUnit)unit);
                }
            }
            return host;
        }
        public static ProcessingUnitHost FromConfiguration(MessagePipelineSection configuration)
        {
            ProcessingUnitHost            host           = new ProcessingUnitHost();
            Dictionary <string, IChannel> mChannelLookup = new Dictionary <string, IChannel>();

            for (int i = 0; i < configuration.Pipelines.Count; i++)
            {
                for (int j = 0; j < configuration.Pipelines[i].Channels.Count; j++)
                {
                    var channel = configuration.Pipelines[i].Channels[j];
                    if (channel.Scheme != "sb")
                    {
                        throw new NotImplementedException("Schemes other than 'sb' are not supported.");
                    }
                    //TODO: this is not nice... other/better way to do injection (support custom implementation)
                    mChannelLookup.Add(channel.Name, (IChannel)Activator.CreateInstance
                                           (Type.GetType("IntegrationPatterns.ServiceBus.Channel, IntegrationPatterns.ServiceBus"),
                                           channel.Name));
                }
                for (int j = 0; j < configuration.Pipelines[i].ProcessingUnits.Count; j++)
                {
                    var config = configuration.Pipelines[i].ProcessingUnits[j];
                    var unit   = Activator.CreateInstance(Type.GetType(config.UnitType));
                    fixChannelReferences(((ProcessingUnit)unit).InputChannels, config.Inputs, mChannelLookup);
                    fixChannelReferences(((ProcessingUnit)unit).OutputChannels, config.Outputs, mChannelLookup);
                    fixChannelReferences(((ProcessingUnit)unit).ControlChannels, config.Controls, mChannelLookup);
                    host.AddProcessingUnit(config.Name, (ProcessingUnit)unit);
                }
            }
            return(host);
        }