![]() |
VOOZH | about |
dotnet add package Milvasoft.Milvaion.Sdk --version 10.1.2
NuGet\Install-Package Milvasoft.Milvaion.Sdk -Version 10.1.2
<PackageReference Include="Milvasoft.Milvaion.Sdk" Version="10.1.2" />
<PackageVersion Include="Milvasoft.Milvaion.Sdk" Version="10.1.2" />Directory.Packages.props
<PackageReference Include="Milvasoft.Milvaion.Sdk" />Project file
paket add Milvasoft.Milvaion.Sdk --version 10.1.2
#r "nuget: Milvasoft.Milvaion.Sdk, 10.1.2"
#:package Milvasoft.Milvaion.Sdk@10.1.2
#addin nuget:?package=Milvasoft.Milvaion.Sdk&version=10.1.2Install as a Cake Addin
#tool nuget:?package=Milvasoft.Milvaion.Sdk&version=10.1.2Install as a Cake Tool
Milvaion Worker SDK is a .NET library that enables your applications to execute scheduled jobs dispatched by the Milvaion Scheduler API. It provides automatic job discovery, RabbitMQ integration, offline resilience, health monitoring, and comprehensive retry mechanisms.
IJob implementations and registers them automaticallyInstall the NuGet package:
dotnet add package Milvasoft.Milvaion.Sdk.Worker
Or via Package Manager Console:
Install-Package Milvasoft.Milvaion.Sdk.Worker
Implement the IJob interface:
using Milvaion.Sdk.Worker.Abstractions;
public class SendEmailJob : IJob
{
public async Task<JobExecutionResult> ExecuteAsync(IJobContext context)
{
var email = context.GetData<string>("email");
context.LogInformation($"Sending email to {email}");
// Your business logic here
await Task.Delay(1000);
return JobExecutionResult.Success("Email sent successfully");
}
}
appsettings.json{
"Worker": {
"WorkerId": "email-worker",
"MaxParallelJobs": 5,
"RabbitMQ": {
"Host": "localhost",
"Port": 5672,
"Username": "guest",
"Password": "guest",
"VirtualHost": "/"
},
"Redis": {
"ConnectionString": "localhost:6379",
"Database": 0
},
"Heartbeat": {
"Enabled": true,
"IntervalSeconds": 30
},
"OfflineResilience": {
"Enabled": true,
"LocalStoragePath": "./worker_data"
}
},
"JobConsumers": {
"SendEmailJob": {
"ConsumerId": "sendemail-consumer",
"MaxParallelJobs": 3,
"ExecutionTimeoutSeconds": 300,
"MaxRetries": 3,
"BaseRetryDelaySeconds": 60,
"RoutingPatterns": ["sendemail.*"]
}
}
}
Program.csusing Microsoft.Extensions.Hosting;
using Milvaion.Sdk.Worker;
var builder = Host.CreateApplicationBuilder(args);
// Auto-discover jobs and register worker services
builder.Services.AddMilvaionWorkerWithJobs(builder.Configuration);
var host = builder.Build();
await host.RunAsync();
| Property | Type | Default | Description |
|---|---|---|---|
WorkerId |
string |
"worker" |
Unique identifier for this worker instance |
MaxParallelJobs |
int |
10 |
Maximum concurrent job executions |
RabbitMQ.Host |
string |
"localhost" |
RabbitMQ server hostname |
RabbitMQ.Port |
int |
5672 |
RabbitMQ server port |
RabbitMQ.Username |
string |
"guest" |
RabbitMQ username |
RabbitMQ.Password |
string |
"guest" |
RabbitMQ password |
Redis.ConnectionString |
string |
"localhost:6379" |
Redis connection string |
Heartbeat.Enabled |
bool |
true |
Enable worker heartbeat |
Heartbeat.IntervalSeconds |
int |
30 |
Heartbeat interval |
OfflineResilience.Enabled |
bool |
false |
Enable outbox pattern |
Each job can have dedicated configuration under JobConsumers:
| Property | Type | Default | Description |
|---|---|---|---|
ConsumerId |
string |
Required | Unique consumer identifier |
MaxParallelJobs |
int |
(inherits) | Job-specific concurrency limit |
ExecutionTimeoutSeconds |
int |
300 |
Maximum execution time |
MaxRetries |
int |
3 |
Number of retry attempts |
BaseRetryDelaySeconds |
int |
60 |
Initial retry delay (exponential backoff) |
RoutingPatterns |
string[] |
Auto-generated | RabbitMQ routing key patterns |
IJob implementations on startupRunning, Completed, or Failed status to APIWhen enabled, the SDK stores logs and status updates locally when the central API is unreachable:
{
"OfflineResilience": {
"Enabled": true,
"LocalStoragePath": "./worker_data",
"SyncIntervalSeconds": 60
}
}
Jobs can be cancelled via Redis pub/sub:
public class LongRunningJob : IJob
{
public async Task<JobExecutionResult> ExecuteAsync(IJobContext context)
{
for (int i = 0; i < 100; i++)
{
// Check cancellation token
context.CancellationToken.ThrowIfCancellationRequested();
await Task.Delay(1000, context.CancellationToken);
}
return JobExecutionResult.Success();
}
}
context.LogInformation() for traceable logsWorkerIdSee the SampleWorker project for a reference implementation.
public class UnreliableApiJob : IJob
{
private readonly HttpClient _httpClient;
public UnreliableApiJob(HttpClient httpClient)
{
_httpClient = httpClient;
}
public async Task<JobExecutionResult> ExecuteAsync(IJobContext context)
{
try
{
var response = await _httpClient.GetAsync(context.GetData<string>("url"));
response.EnsureSuccessStatusCode();
return JobExecutionResult.Success();
}
catch (HttpRequestException ex)
{
// Will automatically retry based on MaxRetries config
return JobExecutionResult.Failure($"API call failed: {ex.Message}");
}
}
}
Configuration:
{
"JobConsumers": {
"UnreliableApiJob": {
"ConsumerId": "api-consumer",
"MaxRetries": 5,
"BaseRetryDelaySeconds": 30
}
}
}
Licensed under the MIT License.
Built with love by Milvasoft
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 3 NuGet packages that depend on Milvasoft.Milvaion.Sdk:
| Package | Downloads |
|---|---|
|
Milvasoft.Milvaion.Sdk.Worker
Worker SDK for Milvaion Scheduler. |
|
|
Milvasoft.Milvaion.Sdk.Worker.Quartz
Quartz.NET integration for Milvaion Worker SDK. |
|
|
Milvasoft.Milvaion.Sdk.Worker.Hangfire
Hangfire integration for Milvaion Worker SDK. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.1.2 | 129 | 6/7/2026 |
| 10.1.1 | 136 | 5/21/2026 |
| 10.1.0 | 145 | 3/25/2026 |
| 10.0.17 | 167 | 3/8/2026 |
| 10.0.16 | 136 | 3/5/2026 |
| 10.0.15 | 136 | 2/10/2026 |
| 10.0.14 | 134 | 2/5/2026 |
| 10.0.13 | 142 | 2/5/2026 |
| 10.0.12 | 154 | 2/1/2026 |
| 10.0.11 | 131 | 1/22/2026 |
| 10.0.10 | 124 | 1/20/2026 |
| 10.0.9 | 123 | 1/20/2026 |
| 10.0.8 | 122 | 1/18/2026 |
| 10.0.7 | 132 | 1/17/2026 |
| 10.0.6 | 119 | 1/17/2026 |
| 10.0.5 | 128 | 1/16/2026 |
| 10.0.4 | 89 | 1/15/2026 |
| 10.0.3 | 80 | 1/15/2026 |
| 10.0.2 | 95 | 1/7/2026 |
| 10.0.1 | 94 | 1/7/2026 |