HoneyDrunk.Kernel 0.2.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package HoneyDrunk.Kernel --version 0.2.1
                    
NuGet\Install-Package HoneyDrunk.Kernel -Version 0.2.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="HoneyDrunk.Kernel" Version="0.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HoneyDrunk.Kernel" Version="0.2.1" />
                    
Directory.Packages.props
<PackageReference Include="HoneyDrunk.Kernel" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add HoneyDrunk.Kernel --version 0.2.1
                    
#r "nuget: HoneyDrunk.Kernel, 0.2.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.
#:package HoneyDrunk.Kernel@0.2.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=HoneyDrunk.Kernel&version=0.2.1
                    
Install as a Cake Addin
#tool nuget:?package=HoneyDrunk.Kernel&version=0.2.1
                    
Install as a Cake Tool

HoneyDrunk.Kernel

NuGet .NET 10

Runtime Implementations for the HoneyDrunk Grid - Production-ready implementations of all Kernel abstractions.

๐Ÿ“‹ What Is This?

HoneyDrunk.Kernel provides the runtime implementations of all contracts defined in HoneyDrunk.Kernel.Abstractions. This is the package you use when building executable Nodes, services, or applications that participate in the Grid.

๐Ÿ“ฆ What's Inside

๐ŸŒ Context Implementations

  • GridContext - Default implementation with causation chain support
  • NodeContext - Process-scoped Node identity
  • OperationContext - Operation tracking with timing and outcome
  • GridContextAccessor - Async-local context accessor

๐Ÿ”„ Context Mappers

Automatic context propagation from various sources:

  • HttpContextMapper - Maps HTTP headers to GridContext
  • JobContextMapper - Maps background job metadata
  • MessagingContextMapper - Maps message properties for event-driven architectures

โš™๏ธ Lifecycle Management

  • NodeLifecycleManager - Coordinates startup/shutdown
  • NodeLifecycleHost - Hosts Node lifecycle with health/readiness

๐Ÿ“ˆ Diagnostics

  • NoOpMetricsCollector - Zero-overhead placeholder (replace with OpenTelemetry in production)
  • NodeLifecycleHealthContributor - Lifecycle-based health
  • NodeContextReadinessContributor - Context-based readiness

๐Ÿ”ง Configuration

  • StudioConfiguration - Studio-wide configuration implementation

๐Ÿ” Secrets

  • CompositeSecretsSource - Chains multiple secret sources with fallback logic

โค๏ธ Health

  • CompositeHealthCheck - Aggregates multiple health checks

๐Ÿ’‰ Dependency Injection

  • HoneyDrunkCoreExtensions - Core service registration (AddHoneyDrunkCore, AddHoneyDrunkCoreNode)
  • ServiceProviderValidation - Startup validation

๐Ÿ“ฅ Installation

dotnet add package HoneyDrunk.Kernel
<PackageReference Include="HoneyDrunk.Kernel" Version="0.2.1" />

Note: This package automatically includes HoneyDrunk.Kernel.Abstractions as a dependency.

๐Ÿš€ Quick Start

Basic Node Setup

using HoneyDrunk.Kernel.Abstractions.Hosting;
using HoneyDrunk.Kernel.DependencyInjection;

var builder = WebApplication.CreateBuilder(args);

// Register Kernel services with Node descriptor
var nodeDescriptor = new NodeDescriptor
{
    NodeId = "payment-node",
    Version = "1.0.0",
    Name = "Payment Processing Node",
    Sector = "commerce",
    Cluster = "payments-cluster"
};

builder.Services.AddHoneyDrunkCoreNode(nodeDescriptor);

var app = builder.Build();

// Validate services before starting
app.Services.ValidateHoneyDrunkServices();

app.Run();

Using Context in Services

public class OrderService(
    IGridContext gridContext,
    INodeContext nodeContext,
    ILogger<OrderService> logger)
{
    public async Task ProcessOrderAsync(Order order)
    {
        logger.LogInformation(
            "Processing order {OrderId} on Node {NodeId} with correlation {CorrelationId}",
            order.Id,
            nodeContext.NodeId,
            gridContext.CorrelationId);
        
        // Create child context for downstream call
        var childContext = gridContext.CreateChildContext("payment-node");
        await _paymentService.ChargeAsync(order, childContext);
    }
}

HTTP Context Mapping

// Automatically maps X-Correlation-ID, X-Causation-ID, X-Baggage-* headers
app.UseMiddleware<GridContextMiddleware>();

app.MapPost("/orders", async (Order order, IGridContext gridContext) =>
{
    // gridContext is automatically populated from HTTP headers
    await _orderService.ProcessOrderAsync(order);
    return Results.Created($"/orders/{order.Id}", order);
});

Lifecycle Hooks

// Register startup hooks
builder.Services.AddSingleton<IStartupHook, DatabaseMigrationHook>();
builder.Services.AddSingleton<IStartupHook, CacheWarmupHook>();

// Register shutdown hooks
builder.Services.AddSingleton<IShutdownHook, ConnectionDrainHook>();

// Register health contributors
builder.Services.AddSingleton<IHealthContributor, DatabaseHealthContributor>();
builder.Services.AddSingleton<IReadinessContributor, CacheReadinessContributor>();

๐ŸŽฏ When to Use This Package

Use HoneyDrunk.Kernel when:

  • โœ… Building an executable Node/service
  • โœ… You need context mappers (HTTP, messaging, jobs)
  • โœ… You need lifecycle orchestration
  • โœ… You want production-ready implementations

Use HoneyDrunk.Kernel.Abstractions only when:

  • โœ… Building a library (use abstractions to avoid implementation dependencies)
  • โœ… Creating custom implementations

๐Ÿ—๏ธ Architecture

Context Flow

HTTP Request with X-Correlation-ID header
    โ†“
HttpContextMapper extracts header โ†’ GridContext
    โ†“
GridContext injected into OrderService
    โ†“
OrderService creates child context for PaymentService
    โ†“
ChildContext propagates to downstream Node

Lifecycle Flow

Application Start
    โ†“
NodeLifecycleStage = Initializing
    โ†“
Execute IStartupHook instances (by priority)
    โ†“
Check IReadinessContributor instances
    โ†“
NodeLifecycleStage = Running
    โ†“
(Application runs...)
    โ†“
Shutdown signal received
    โ†“
NodeLifecycleStage = Stopping
    โ†“
Stop accepting new requests
    โ†“
Execute IShutdownHook instances (by priority)
    โ†“
NodeLifecycleStage = Stopped

โš™๏ธ Configuration

appsettings.json

{
  "Grid": {
    "NodeId": "payment-node",
    "Version": "1.0.0",
    "StudioId": "honeycomb",
    "Environment": "production",
    "Tags": {
      "deployment-slot": "blue",
      "region": "us-east-1"
    }
  },
  "NodeRuntime": {
    "Environment": "production",
    "Region": "us-east-1",
    "EnableDetailedTelemetry": true,
    "EnableDistributedTracing": true,
    "TelemetrySamplingRate": 1.0,
    "HealthCheckIntervalSeconds": 30,
    "ShutdownGracePeriodSeconds": 30
  }
}

๐Ÿ“š Documentation

๐Ÿงช Testing

See Testing Guide for patterns on:

  • Mocking GridContext, NodeContext, OperationContext
  • Testing with deterministic time
  • Integration testing with DI
  • Testing lifecycle hooks and health contributors

๐Ÿ“„ License

This project is licensed under the MIT License.


Built with ๐Ÿฏ by HoneyDrunk Studios

GitHub โ€ข Documentation โ€ข Issues

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on HoneyDrunk.Kernel:

Package Downloads
HoneyDrunk.Vault

Secrets and configuration management library for .NET. Provides a unified abstraction for accessing secrets from multiple providers (File, Azure Key Vault, AWS Secrets Manager, Configuration, In-Memory). Integrated with HoneyDrunk.Kernel v0.8.0 for lifecycle management, health reporting, and distributed telemetry.

HoneyDrunk.Data

Provider-neutral persistence orchestration layer for HoneyDrunk.OS Grid. Complete architecture overhaul with Kernel integration for tenant resolution, correlation tracking, and telemetry enrichment. Does not depend on any specific database provider.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.8.0 3,283 5/26/2026
0.7.0 2,118 5/18/2026
0.6.0 116 5/17/2026
0.5.0 525 5/4/2026
0.4.0 1,713 1/19/2026
0.3.0 395 11/28/2025
0.2.1 246 11/22/2025
0.2.0 255 11/22/2025
0.1.2 427 11/13/2025
0.1.1 368 11/10/2025
0.1.0 182 11/7/2025

v0.2.1: Fixed README emoji encoding issues. v0.2.0: Major refactor as semantic OS layer. Added GridContext implementations, context mappers for HTTP/Messaging/Jobs, lifecycle orchestration, and telemetry integration. See CHANGELOG.md for details.