2023-02-14 17:51:22 -08:00
|
|
|
|
2023-02-19 21:39:03 -08:00
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
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
|
|
|
|
{
|
|
|
|
private HelloWorldJobOptions _options;
|
|
|
|
|
|
|
|
public HelloWorldJob(HelloWorldJobOptions options)
|
2023-02-14 17:51:22 -08:00
|
|
|
{
|
2023-02-19 21:39:03 -08:00
|
|
|
_options = options;
|
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-19 21:39:03 -08:00
|
|
|
_options = options;
|
|
|
|
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-19 21:39:03 -08:00
|
|
|
Console.WriteLine(_options.Message);
|
2023-02-14 17:51:22 -08:00
|
|
|
}
|
|
|
|
}
|