Milvasoft.Templates.Milvaion 10.1.0

Prefix Reserved
dotnet new install Milvasoft.Templates.Milvaion::10.1.0
                    
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 9.0
dotnet new milvaion-worker -n MyWorker --Framework net9.0

# Use .NET 10.0 (default)
dotnet new milvaion-worker -n MyWorker --Framework net10.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

  • net10.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
10.1.0 155 3/25/2026
10.0.13 170 3/8/2026
10.0.12 160 3/5/2026
10.0.11 194 2/10/2026
10.0.10 191 2/5/2026
10.0.9 190 2/5/2026
10.0.8 201 2/1/2026
10.0.7 212 1/22/2026
10.0.6 206 1/20/2026
10.0.5 204 1/18/2026
10.0.4 209 1/17/2026
10.0.3 223 1/16/2026
10.0.2 215 1/15/2026
10.0.1 220 1/8/2026
10.0.0 224 1/7/2026