public override void AddToEngine(RFEngineDefinition engine) { if (TriggerKey != null) { engine.AddCatalogUpdateTrigger <RFCatalogKey>(k => k.MatchesRoot(TriggerKey), TaskProcess); } }
public RFGraphDefinition(string graphName, RFEngineDefinition engineConfig) { GraphName = graphName; EngineConfig = engineConfig; GraphTasks = new List <RFGraphTaskDefinition>(); Processes = new Dictionary <string, RFGraphProcessDefinition>(); }
public RFServiceEnvironment(string environment, RFEngineDefinition config, string dbConnection) { _context = new RFComponentContext { CancellationTokenSource = new CancellationTokenSource(), Catalog = null, UserConfig = new RFCachedUserConfig(dbConnection, environment), SystemConfig = new RFSystemConfig { Environment = environment, IntervalLength = config.IntervalSeconds * 1000, ProcessingMode = RFProcessingMode.RFContinuous, DocumentStoreConnectionString = dbConnection, Downtime = RFSettings.GetDowntime() } }; RFStatic.Log = new RFLog4NetLog(dbConnection); var engine = new RFSimpleEngine(config, _context); _context.Engine = engine; _context.Catalog = new RFSQLCatalog(_context); _context.UserLog = new RFSQLUserLog(_context); _context.UserRole = new RFSQLUserRole(dbConnection); _context.DispatchStore = new RFDispatchStoreSQL(_context); _workQueue = new RFGraphDispatchQueue(engine.GetWeights(), engine.GetDependencies(), engine.GetExclusiveProcesses(), _context); RFEnvironments.LogLicenseInfo(config); }
public RFConsoleEnvironment(string environment, RFEngineDefinition config, string dbConnection) { _context = new RFComponentContext { CancellationTokenSource = new CancellationTokenSource(), Catalog = null, UserConfig = new RFCachedUserConfig(dbConnection, environment), UserRole = new RFSQLUserRole(dbConnection), SystemConfig = new RFSystemConfig { Environment = environment, ProcessingMode = RFProcessingMode.RFSinglePass, IntervalLength = config.IntervalSeconds, DocumentStoreConnectionString = dbConnection } }; if (RFStatic.Log == null) { RFStatic.Log = new RFLog4NetLog(dbConnection); } // reuse parent context for database-access, but create a new engine and work queue (for tracking) var engine = new RFSimpleEngine(config, _context); _context.Catalog = new RFSQLCatalog(_context); _context.ActiveComponents = new List <RFActiveComponent>(); _context.Engine = engine; _context.UserLog = new RFSQLUserLog(_context); _context.DispatchStore = new RFDispatchStoreSQL(_context); _workQueue = new RFGraphDispatchQueue(engine.GetWeights(), engine.GetDependencies(), engine.GetExclusiveProcesses(), _context); RFEnvironments.LogLicenseInfo(config); }
public RFEngineDefinition BuildEngineConfiguration() { RFEngineDefinition engine = null; if (Assembly.NotBlank()) { var engineAssembly = System.Reflection.Assembly.LoadFrom(Assembly); var configurator = engineAssembly.CreateInstance(Class) as IRFEngineBuilder; if (RFStatic.Log == null) { RFStatic.Log = new RFLog4NetLog(Database); } try { engine = configurator.BuildEngine(Database, Environment); } catch (Exception ex) { RFStatic.Log.Exception(this, "Fatal error initializing engine", ex); } } if (engine == null) { engine = RFEngineDefinition.Create("Empty", new RFSimpleKeyDomain("null")); } engine.LicenseTokens = LicenseTokens; engine.Assembly = Assembly; engine.Environment = Environment; return(engine); }
public RFSimpleEngine(RFEngineDefinition config, RFComponentContext componentContext) : base(componentContext) { _config = config; _reactors = new List <RFEventReactor>(); _processes = new Dictionary <string, RFEngineProcess>(); _services = new List <RFBackgroundServiceComponent>(); }
internal static void LogLicenseInfo(RFEngineDefinition config) { var license = RIFF.Core.RFPublicRSA.GetHost(config.LicenseTokens.Key, config.LicenseTokens.Value); RFStatic.Log.Info(typeof(RFCore), ">>> RIFF Framework {0} | (c) rohatsu software studios limited | www.rohatsu.com", RFCore.sVersion); RFStatic.Log.Info(typeof(RFCore), ">>> Licensed to '{0}' ({1})", license.Key, license.Value.ToString(RFCore.sDateFormat)); RFStatic.Log.Info(typeof(RFCore), ">>> Loaded engine {0} from {1} in environment {2}", config?.EngineName, config?.Assembly, config?.Environment); }
public void Initialize(IRFProcessingContext context, RFEngineDefinition engineConfig, string connectionString) { _context = context; _engineConfig = engineConfig; _connectionString = connectionString; Initialize(); }
/// <summary> /// Start a simple one-process engine using default providers. /// </summary> /// <param name="config">Engine configuration.</param> /// <param name="dbConnection">Database connection string.</param> /// <returns>Context for accessing the environment.</returns> public static IRFEnvironment StartLocal(string environment, RFEngineDefinition config, string dbConnection, IEnumerable <string> engineAssemblies) { LoadReferencedAssemblies(); var le = new RFServiceEnvironment(environment, config, dbConnection); RFXMLSerializer.Initialize(engineAssemblies); RFRazor.Initialize(engineAssemblies); return(le); }
/// <summary> /// Environment for a single request, underneath an optional parent environment. /// </summary> /// <param name="dbConnection">Database connection string.</param> /// <returns>Context for accessing the environment.</returns> public static IRFEnvironment StartConsole(string environment, RFEngineDefinition config, string dbConnection, IEnumerable <string> engineAssemblies = null) { LoadReferencedAssemblies(); var se = new RFConsoleEnvironment( environment: environment, config: config, dbConnection: dbConnection ); RFXMLSerializer.Initialize(engineAssemblies); RFRazor.Initialize(engineAssemblies); return(se); }
public override void AddToEngine(RFEngineDefinition engine) { var triggerName = RFEnum.FromString(TaskName); var triggerKey = RFSchedulerTriggerKey.Create(engine.KeyDomain, triggerName); engine.AddCatalogUpdateTrigger <RFSchedulerTriggerKey>(k => k.TriggerName.Equals(triggerName), TaskProcess); engine.Schedules.Add(c => new RFSchedulerConfig { Range = RangeFunc(c), Schedules = SchedulesFunc(c), TriggerKey = triggerKey, IsEnabled = c.UserConfig.GetBool(CONFIG_SECTION, TaskName, false, true, "Is Enabled") }); }
public override void AddToEngine(RFEngineDefinition engine) { var scheduler = engine.AddProcess( processName: String.Format("Task {0} Scheduler", TaskName), description: string.Format("Schedules task {0}", TaskName), processor: () => new RFSchedulerProcessor(new RFSchedulerConfig { Range = RangeFunc(), Schedules = SchedulesFunc(), TriggerKey = TriggerKey, GraphInstance = (i) => TriggerKey.GraphInstance.WithDate(i.IntervalEnd.Date) })); engine.AddIntervalTrigger(scheduler); }
public override void AddToEngine(RFEngineDefinition engine) { var triggerName = RFEnum.FromString(TaskName); var triggerKey = RFSchedulerTriggerKey.Create(engine.KeyDomain, triggerName); var scheduler = engine.AddProcess( processName: String.Format("Task {0} Scheduler", TaskName), description: string.Format("Schedules task {0}", TaskName), processor: () => new RFSchedulerProcessor(new RFSchedulerConfig { Range = RangeFunc(), Schedules = SchedulesFunc(), TriggerKey = triggerKey })); engine.AddIntervalTrigger(scheduler); engine.AddCatalogUpdateTrigger <RFSchedulerTriggerKey>(k => k.TriggerName.Equals(triggerName), TaskProcess); }
public abstract void AddToEngine(RFEngineDefinition engine);
public override void AddToEngine(RFEngineDefinition engine) { engine.AddTrigger(new RFSingleCommandTrigger(e => ((e is RFProcessingFinishedEvent) && (e as RFProcessingFinishedEvent).GetFinishedProcessName() == TriggerProcess.Name) ? new RFParamProcessInstruction(TaskProcess.Name, null) : null)); }