Milvasoft.Templates.Milvaion 11.2.1

Prefix Reserved
dotnet new install Milvasoft.Templates.Milvaion@11.2.1
                    
This package contains a .NET Template Package you can call from the shell/command line.

Milvaion Worker Templates

license NuGet
NuGet

This package contains project templates for creating Milvaion Workers.

milva-bird

Templates

Console Worker Template

Short Name: milvaion-worker

A console-based worker for executing scheduled jobs in background processes.

Features

  • Background console application
  • Job discovery and auto-registration
  • RabbitMQ job consumer
  • Redis integration for cancellation signals
  • Offline resilience with outbox pattern
  • Docker support

Usage

dotnet new milvaion-worker -n MyWorker

API Worker Template

Short Name: milvaion-api-worker

An ASP.NET Core Web API worker with REST endpoints for monitoring and management.

Features

  • All Console Worker features
  • Built-in REST API endpoints
  • Health check endpoint
  • Offline storage statistics endpoint
  • OpenAPI/Swagger support
  • Easy to add custom endpoints

Usage

dotnet new milvaion-api-worker -n MyApiWorker

Installation

Install the template package:

dotnet new install Milvasoft.Templates.Milvaion

Available Templates

After installation, you'll see both templates:

dotnet new list milvaion

Template Name            Short Name             Language  Tags
-----------------------  ---------------------  --------  -----------------------
Milvaion Console Worker  milvaion-worker        [C#]      Console/Worker/Milvaion
Milvaion Api Worker      milvaion-api-worker    [C#]      Api/Worker/Milvaion

Quick Start

Create a Console Worker

# Create new console worker
dotnet new milvaion-worker -n EmailWorker

# Navigate to project
cd EmailWorker

# Run the worker
dotnet run

Create an API Worker

# Create new API worker
dotnet new milvaion-api-worker -n ReportWorker

# Navigate to project
cd ReportWorker

# Run the API worker
dotnet run

# Access API at http://localhost:5000
# Check storage stats: http://localhost:5000/offline-storage-stats

Template Options

Both templates support the following options:

Framework Selection

# Use .NET 11.0 (default and only supported framework)
dotnet new milvaion-worker -n MyWorker --Framework net11.0

Nullable Context

# Enable nullable (default: disable)
dotnet new milvaion-worker -n MyWorker --Nullable enable

# Disable nullable
dotnet new milvaion-worker -n MyWorker --Nullable disable

Configuration

Both templates use the same configuration structure in appsettings.json:

{
  "Worker": {
    "WorkerId": "my-worker",
    "MaxParallelJobs": 128,
    "RabbitMQ": {
      "Host": "localhost",
      "Port": 5672,
      "Username": "guest",
      "Password": "guest"
    },
    "Redis": {
      "ConnectionString": "localhost:6379"
    },
    "Heartbeat": {
      "Enabled": true,
      "IntervalSeconds": 30
    },
    "OfflineResilience": {
      "Enabled": true,
      "LocalStoragePath": "./worker_data"
    }
  },
  "JobConsumers": {
    "SimpleJob": {
      "ConsumerId": "simple-consumer",
      "MaxParallelJobs": 32,
      "ExecutionTimeoutSeconds": 120,
      "MaxRetries": 3
    }
  }
}

Adding Jobs

Create a new job class implementing IAsyncJob:

using Milvasoft.Milvaion.Sdk.Worker.Abstractions;

public class MyJob : IAsyncJob
{
    public async Task ExecuteAsync(IJobContext context)
    {
        context.LogInformation("Job started!");
        
        // Your business logic here
        await Task.Delay(1000, context.CancellationToken);
        
        context.LogInformation("Job completed!");
    }
}

Add configuration to appsettings.json:

{
  "JobConsumers": {
    "MyJob": {
      "ConsumerId": "my-consumer",
      "MaxParallelJobs": 10,
      "ExecutionTimeoutSeconds": 300,
      "MaxRetries": 3
    }
  }
}

Docker Support

Both templates include Dockerfile:

# Build image
docker build -t my-worker .

# Run container
docker run -d \
  --name my-worker \
  --network milvaion-network \
  -e Worker__WorkerId=worker-01 \
  -e Worker__RabbitMQ__Host=rabbitmq \
  my-worker

API Worker Endpoints

The API Worker template includes these endpoints:

Storage Statistics

GET /offline-storage-stats

Returns information about pending logs and status updates.

OpenAPI

GET /openapi/v1.json

OpenAPI specification (in Development mode).

Uninstall

To uninstall the templates:

dotnet new uninstall Milvasoft.Templates.Milvaion

Documentation

Support

License

Licensed under the MIT License.


Built with love by Milvasoft

  • net11.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.2.1 48 11/21/2026
11.2.0 120 11/14/2026
11.1.0 115 11/14/2026
11.0.0 121 11/13/2026
10.2.1 139 10/23/2026
10.2.0 257 8/10/2026
10.1.6 247 8/2/2026
10.1.5 240 7/23/2026
10.1.4 254 7/9/2026
10.1.3 254 7/9/2026
10.1.1 324 6/7/2026
10.1.0 386 3/25/2026
10.0.13 407 3/8/2026
10.0.12 393 3/5/2026
10.0.11 426 2/10/2026
10.0.10 430 2/5/2026
10.0.9 428 2/5/2026
10.0.8 439 2/1/2026
10.0.7 449 1/22/2026
10.0.6 444 1/20/2026
Loading failed