public virtual IChannelGroup Build(IChannelConnector connector, IChannelGroupConfiguration configuration)
        {
            if (connector == null)
            {
                throw new ArgumentNullException("connector");
            }

            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            if (configuration.Synchronous)
            {
                Log.Debug("Building a synchronous channel group named '{0}'.", configuration.GroupName);
                return(new SynchronousChannelGroup(connector, configuration));
            }

            Log.Debug("Building an asynchronous channel group named '{0}'.", configuration.GroupName);
            var workers = new TaskWorkerGroup <IMessagingChannel>(
                configuration.MinWorkers, configuration.MaxWorkers, configuration.MaxDispatchBuffer);

            return(new DefaultChannelGroup(connector, configuration, workers));
        }
 protected static void Build()
 {
     workerGroup = new TaskWorkerGroup <IMessagingChannel>(minWorkers, maxWorkers, maxBufferSize);
 }