/// <summary> /// This method executes the runner /// </summary> public void Run() { // Define our ticker Core.Ticker ticker = new Core.Ticker(); // Execte the task Task(ticker); // Execute the completion callback WhenTaskDone(ticker); }
/// <summary> /// This method runs the PublicSuffix Hostname example(s) /// </summary> /// <param name="ticker"></param> /// <returns></returns> protected override void Task(Core.Ticker ticker) { // Execute our valid test model Valid(); // Execute our invalid test model Invalid(); // Execute our custom test model Custom(); }
/// <summary> /// This method asynchronously executes the runner /// </summary> /// <returns></returns> public async Task RunAsync() { // Define our ticker Core.Ticker ticker = new Core.Ticker(); // Execute the task await TaskAsync(ticker); // Execute the completion callback WhenTaskDone(ticker); }
/// <summary> /// This method asynchronously runs the PublicSuffix Hostname example(s) /// </summary> /// <param name="ticker"></param> /// <returns></returns> protected override async Task TaskAsync(Core.Ticker ticker) { // Run the valid test model await ValidAsync(); // Run the invalid test model await InvalidAsync(); // Run the custom test model await CustomAsync(); }
/// <summary> /// This method runs the Redis example /// </summary> /// <param name="ticker"></param> /// <returns></returns> protected override void Task(Core.Ticker ticker) { // Run the Redis boolean task Boolean(); // Run the Redis double task Double(); // Run the Redis integer task Integer(); // Run the Redis key object task KeyObject(); // Run the Redis object task Object(); // Run the Redis string task String(); }
/// <summary> /// This method runs the Environment variable example /// </summary> /// <param name="ticker"></param> /// <returns></returns> protected override void Task(Core.Ticker ticker) { // Run the Environment variable boolean task Boolean(); // Run the Environment variable double task Double(); // Run the Environment variable integer task Integer(); // Run the Environment variable key object task KeyObject(); // Run the Environment variable object task Object(); // Run the Environment variable string task String(); }
/// <summary> /// This method adds and runs a FAF task with a custom external ID /// </summary> /// <param name="taskId"></param> /// <param name="task"></param> /// <returns></returns> protected string FireAndForget(string taskId, DelegateFireAndForgetTask task) { // Define our ticker Core.Ticker ticker = new Core.Ticker(); // Start the ticker ticker.Reset(); // Add the FAF task to the instance _fafMap[taskId] = task .Invoke(taskId, ticker) .ContinueWith((asyncTask) => { // Stop our ticker and localize the time table Core.TickerTimeTable tickerTimeTable = ticker.Halt(); // Define our parts List <string> parts = new List <string>(); // Define our prefix parts.Add($"[Internal: {asyncTask.Id} F*x: {taskId}] Task"); // Check the cancelled flag if (asyncTask.IsCanceled) { parts.Add("was Cancelled in ${taskElapsed}"); } // Check the completed successfully flag if (asyncTask.IsCompletedSuccessfully) { parts.Add("Completed Successfully in ${taskElapsed}"); } // Check the faulted flag if (asyncTask.IsFaulted) { parts.Add("Faulted in ${taskElapsed} [Error: ${exceptionMessage}]"); } // Check the completed flag if (asyncTask.IsCompleted) { parts.Add("Completed in ${taskElapsed}"); } // Log the message LogMessage( Helper.Message.New(string.Join(' ', parts)) .WithDataObject("taskElapsed", tickerTimeTable.Elapsed) .WithDataObject("exceptionMessage", asyncTask.Exception?.Message)); // Dispose of the task asyncTask.Dispose(); }); // Return the unique ID of the FAF task return(taskId); }
/// <summary> /// This method runs the Docker secret example /// </summary> /// <param name="ticker"></param> /// <returns></returns> protected override void Task(Core.Ticker ticker) { // Reset the Docker secret path F*x.Config.Docker.SetSecretsDirectory(DockerSecretDirectory); // Run the Docker secret boolean task Boolean(); // Run the Docker secret double task Double(); // Run the Docker secret integer task Integer(); // Run the Docker secret key object task KeyObject(); // Run the Docker secret object task Object(); // Run the Docker secret string task String(); }
/// <summary> /// This method runs the Redis example asynchronously /// </summary> /// <param name="ticker"></param> /// <returns></returns> protected override async Task TaskAsync(Core.Ticker ticker) { // Run the Redis boolean task await BooleanAsync(); // Run the Redis double task await DoubleAsync(); // Run the Redis integer task await IntegerAsync(); // Run the Redis key object task await KeyObjectAsync(); // Run the Redis object task await ObjectAsync(); // Run the Redis string task await StringAsync(); }
/// <summary> /// This method runs the Docker secret example asynchronously /// </summary> /// <param name="ticker"></param> /// <returns></returns> protected override async Task TaskAsync(Core.Ticker ticker) { // Reset the Docker secret path F*x.Config.Docker.SetSecretsDirectory(DockerSecretDirectory); // Run the Docker secret boolean task await BooleanAsync(); // Run the Docker secret double task await DoubleAsync(); // Run the Docker secret integer task await IntegerAsync(); // Run the Docker secret key object task await KeyObjectAsync(); // Run the Docker secret object task await ObjectAsync(); // Run the Docker secret string task await StringAsync(); }
/// <summary> /// This method logs a message when the task is done /// </summary> /// <param name="ticker"></param> protected void WhenTaskDone(Core.Ticker ticker) => LogMessage(Helper.Message.New("Task Completed In ${tickerElapsed}") .WithDataObject("tickerElapsed", ticker.Halt().Elapsed));
/// <summary> /// This method is responsible for the specific asynchronous action of the runner /// </summary> /// <param name="ticker"></param> /// <returns></returns> protected virtual Task TaskAsync(Core.Ticker ticker) => throw new NotImplementedException();
/// <summary> /// This method is responsible for the specific action of the runner /// </summary> /// <param name="ticker"></param> /// <returns></returns> protected virtual void Task(Core.Ticker ticker) => throw new NotImplementedException();
/// <summary> /// This method asynchronously runs the Environment variable example /// </summary> /// <param name="ticker"></param> /// <returns></returns> protected override Task TaskAsync(Core.Ticker ticker) => System.Threading.Tasks.Task.Run(() => Task(ticker));