示例#1
0
        protected override void Setup(FeatureConfigurationContext context)
        {
            var instanceMappingLoader = CreateInstanceMappingLoader(context.Settings);

            var checkInterval     = context.Settings.Get <TimeSpan>(CheckIntervalSettingsKey);
            var endpointInstances = context.Settings.Get <EndpointInstances>();

            var instanceMappingTable = new InstanceMappingFileMonitor(checkInterval, new AsyncTimer(), instanceMappingLoader, endpointInstances);

            instanceMappingTable.ReloadData();
            context.RegisterStartupTask(instanceMappingTable);
        }
示例#2
0
        protected override void Setup(FeatureConfigurationContext context)
        {
            var filePath = GetRootedPath(context.Settings.Get <string>(FilePathSettingsKey));

            if (!File.Exists(filePath))
            {
                throw new Exception($"The specified instance mapping file '{filePath}' does not exist.");
            }

            var checkInterval     = context.Settings.Get <TimeSpan>(CheckIntervalSettingsKey);
            var endpointInstances = context.Settings.Get <EndpointInstances>();

            var instanceMappingTable = new InstanceMappingFileMonitor(filePath, checkInterval, new AsyncTimer(), new InstanceMappingFileAccess(), endpointInstances);

            instanceMappingTable.ReloadData();
            context.RegisterStartupTask(instanceMappingTable);
        }