Omega 1.0.1
dotnet add package Omega --version 1.0.1
NuGet\Install-Package Omega -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Omega" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Omega --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Omega, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Omega as a Cake Addin #addin nuget:?package=Omega&version=1.0.1 // Install Omega as a Cake Tool #tool nuget:?package=Omega&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
OmegaScheduler
Installation
dotnet add package Omega --version 1.0.0
Usage
Worker Class
With TimeOnly
using VNK.Omega.Workers;
public class WorkerClass1 : Worker
{
public override string Name => "Worker 1"
private readonly ILogger<WorkerClass1> _logger;
private new static readonly IEnumerable<TimeOnly> ScheduledTimes = new List<TimeOnly>()
{
new TimeOnly(00, 00, 00),
new TimeOnly(10, 00, 00),
new TimeOnly(18, 00, 00)
};
public WorkerClass1(ILogger<WorkerClass1> logger) : base(ScheduledTimes)
{
_logger = logger;
}
public override async Task RunAsync(CancellationToken cancellationToken)
{
_logger.LogInformation("Starting Worker 1");
await Task.Delay(5_000, cancellationToken);
_logger.LogInformation("Ending Worker 1");
}
}
With string
using VNK.Omega.Workers;
public class WorkerClass2 : Worker
{
public override string Name => "Worker 2";
private readonly ILogger<WorkerClass2> _logger;
private new static readonly string[] ScheduledTimes = new[]
{
"00:00:00",
"10:00:00",
"18:00:00"
};
public WorkerClass2(ILogger<WorkerClass2> logger) : base(ScheduledTimes)
{
_logger = logger;
}
public override async Task RunAsync(CancellationToken cancellationToken)
{
_logger.LogInformation("Starting Worker 2");
await Task.Delay(5_000, cancellationToken);
_logger.LogInformation("Ending Worker 2");
}
}
Dependency Injection
Add Omega Server
#Program.cs
builder.Services.AddOmega(setup =>
{
//default values
setup.EnableLogin = true;
setup.Retries = 3;
setup.MinutesToRetry = 5;
});
Add Workers
#Program.cs
builder.Services.AddWorker<WorkerClass1>();
builder.Services.AddWorker<WorkerClass2>();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
- Microsoft.Extensions.Hosting.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Logging (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.