/// <summary> /// Froms the configuration. /// </summary> /// <param name="path">The path.</param> /// <returns>MessageDispatcher.</returns> public MessageDispatcher FromConfig(string path) { //TODO: this should not exist, it is only here because we dont serialize dispathcer when doing remote deploy.. if (string.IsNullOrEmpty(path)) { var disp = new ThreadPoolDispatcher { Throughput = 100 }; return(disp); } Config config = system.Settings.Config.GetConfig(path); string type = config.GetString("type"); int throughput = config.GetInt("throughput"); //shutdown-timeout //throughput-deadline-time //attempt-teamwork //mailbox-requirement MessageDispatcher dispatcher; switch (type) { case "Dispatcher": dispatcher = new ThreadPoolDispatcher(); break; case "PinnedDispatcher": dispatcher = new SingleThreadDispatcher(); break; case "SynchronizedDispatcher": dispatcher = new CurrentSynchronizationContextDispatcher(); break; default: Type dispatcherType = Type.GetType(type); if (dispatcherType == null) { throw new NotSupportedException("Could not resolve dispatcher type " + type); } dispatcher = (MessageDispatcher)Activator.CreateInstance(dispatcherType); break; } dispatcher.Throughput = throughput; // dispatcher.ThroughputDeadlineTime return(dispatcher); }
public ThreadPoolDispatcherConfigurator(Config config, IDispatcherPrerequisites prerequisites) : base(config, prerequisites) { _instance = new ThreadPoolDispatcher(this); }
/// <summary> /// Froms the configuration. /// </summary> /// <param name="path">The path.</param> /// <returns>MessageDispatcher.</returns> public MessageDispatcher FromConfig(string path) { //TODO: this should not exist, it is only here because we dont serialize dispathcer when doing remote deploy.. if (string.IsNullOrEmpty(path)) { var disp = new ThreadPoolDispatcher { Throughput = 100 }; return disp; } Config config = _system.Settings.Config.GetConfig(path); string type = config.GetString("type"); int throughput = config.GetInt("throughput"); //shutdown-timeout //throughput-deadline-time //attempt-teamwork //mailbox-requirement MessageDispatcher dispatcher; switch (type) { case "Dispatcher": dispatcher = new ThreadPoolDispatcher(); break; case "PinnedDispatcher": dispatcher = new SingleThreadDispatcher(); break; case "SynchronizedDispatcher": dispatcher = new CurrentSynchronizationContextDispatcher(); break; default: Type dispatcherType = Type.GetType(type); if (dispatcherType == null) { throw new NotSupportedException("Could not resolve dispatcher type " + type); } dispatcher = (MessageDispatcher) Activator.CreateInstance(dispatcherType); break; } dispatcher.Throughput = throughput; // dispatcher.ThroughputDeadlineTime return dispatcher; }