public static ISignalsHub New(SignalsConfig config = null) { config = config ?? new SignalsConfig(); return new SignalsHub(config); }
private SignalsHub(SignalsConfig config) { _counters = new Counters(); var ioc = create_dependencies(config); _log = ioc.Resolve<ILogFile>(); _repo = ioc.Resolve<IHubRepo>(); _configRa = ioc.Resolve<ISignalsConfigRa>(); _messenger = ioc.Resolve<IMessengerEngine>(); _agents = ioc.Resolve<IAgentsEngine>(); _idler = ioc.Resolve<IIdler>(); _scheduler = ioc.Resolve<IEventScheduler>(); var target = wcf.SignalsHub.New(this); _host = WcfHost<comm.ISignalsHub>.NewAsync(_log, target); _serviceName = GetType().AsServiceName(); }
private MessengerEngine(IIoC ioc) { _msg2failureHandler = new Dictionary<Type, Action<comm.IoMsg>> { {typeof(comm.PublishMsg), msg => update_failure_counters((comm.PublishMsg) msg)}, {typeof(comm.FilterInfo), msg => update_failure_counters((comm.FilterInfo) msg)}, {typeof(comm.TopicFilterMsg), msg => update_failure_counters((comm.TopicFilterMsg) msg)}, {typeof(comm.HeartbeatMsg), msg => update_failure_counters((comm.HeartbeatMsg) msg)} }; _counters = new Counters(); _configRa = ioc.Resolve<ISignalsConfigRa>(); var config = _configRa.Values; _cachedConfig = config; _log = ThrottledLog.NewSync(config.ThrottledLogTtl, ioc.Resolve<ILogFile>()); _hubUri = _configRa.MakeHubUri(); _connector = ioc.Resolve<IAgentConnector>(); _agents = AgentsRepo.NewSync(); }
public static ISignalsConfigRa New(SignalsConfig config) { return new SignalsConfigRa(config); }
private SignalsConfigRa(SignalsConfig config) { _config = config; }
private static IIoC create_dependencies(SignalsConfig config) { var ioc = IoC.New(); var log = LogFile.New(SignalsComponent.LogName); var configRa = SignalsConfigRa.New(config); var repo = HubRepo.NewSync(); var idler = Idler.New(log); var scheduler = EventScheduler.New(log); var throttledLog = ThrottledLog.NewSync(config.ThrottledLogTtl, log); var messenger = MessengerEngine.New(throttledLog); ioc.Setup() .Register(log) .Register(configRa) .Register(repo) .Register(messenger) .Register(idler) .Register(scheduler); var agents = AgentsEngine.New(ioc); ioc.Setup() .Register(agents); return ioc; }
private string make_agent_uri(SignalsConfig config) { var guid = Guid.NewGuid(); var host = Environment.MachineName; var port = config.Port; var process = "{0}.{1}".Fmt( Process.GetCurrentProcess().ProcessName, Process.GetCurrentProcess().Id); var uri = config.AgentUri.Substitute(new { host, port, process, guid }); return uri; }