Newsbot.Collector/Newsbot.Collector.Services/Jobs/HelloWorldJob.cs

30 lines
524 B
C#
Raw Normal View History

using Serilog;
2023-02-14 17:51:22 -08:00
namespace Newsbot.Collector.Services.Jobs;
public class HelloWorldJobOptions
2023-02-14 17:51:22 -08:00
{
public string Message { get; set; } = "";
}
2023-02-14 17:51:22 -08:00
public class HelloWorldJob
{
private string _message;
public HelloWorldJob()
2023-02-14 17:51:22 -08:00
{
_message = "";
2023-02-14 17:51:22 -08:00
}
public void InitAndExecute(HelloWorldJobOptions options)
{
_message = options.Message;
Execute();
}
private void Execute()
2023-02-14 17:51:22 -08:00
{
Log.Information("Starting 'HelloWorldJob'");
Log.Information(_message);
2023-02-14 17:51:22 -08:00
}
}