2023-02-26 09:40:04 -08:00
|
|
|
using Serilog;
|
2023-02-19 21:39:03 -08:00
|
|
|
|
2023-02-14 17:51:22 -08:00
|
|
|
namespace Newsbot.Collector.Services.Jobs;
|
|
|
|
|
2023-02-19 21:39:03 -08:00
|
|
|
public class HelloWorldJobOptions
|
2023-02-14 17:51:22 -08:00
|
|
|
{
|
2023-02-19 21:39:03 -08:00
|
|
|
public string Message { get; set; } = "";
|
|
|
|
}
|
2023-02-14 17:51:22 -08:00
|
|
|
|
2023-02-19 21:39:03 -08:00
|
|
|
public class HelloWorldJob
|
|
|
|
{
|
2023-02-26 09:40:04 -08:00
|
|
|
private string _message;
|
|
|
|
|
|
|
|
public HelloWorldJob()
|
2023-02-14 17:51:22 -08:00
|
|
|
{
|
2023-02-26 09:40:04 -08:00
|
|
|
_message = "";
|
2023-02-14 17:51:22 -08:00
|
|
|
}
|
|
|
|
|
2023-02-19 21:39:03 -08:00
|
|
|
public void InitAndExecute(HelloWorldJobOptions options)
|
2023-02-16 22:19:05 -08:00
|
|
|
{
|
2023-02-26 09:40:04 -08:00
|
|
|
_message = options.Message;
|
2023-02-19 21:39:03 -08:00
|
|
|
Execute();
|
2023-02-16 22:19:05 -08:00
|
|
|
}
|
|
|
|
|
2023-02-19 21:39:03 -08:00
|
|
|
private void Execute()
|
2023-02-14 17:51:22 -08:00
|
|
|
{
|
2023-02-26 09:40:04 -08:00
|
|
|
Log.Information("Starting 'HelloWorldJob'");
|
|
|
|
Log.Information(_message);
|
2023-02-14 17:51:22 -08:00
|
|
|
}
|
|
|
|
}
|