CoreEx.Events 4.0.0-preview-1

This is a prerelease version of CoreEx.Events.
dotnet add package CoreEx.Events --version 4.0.0-preview-1
                    
NuGet\Install-Package CoreEx.Events -Version 4.0.0-preview-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="CoreEx.Events" Version="4.0.0-preview-1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CoreEx.Events" Version="4.0.0-preview-1" />
                    
Directory.Packages.props
<PackageReference Include="CoreEx.Events" />
                    
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 CoreEx.Events --version 4.0.0-preview-1
                    
#r "nuget: CoreEx.Events, 4.0.0-preview-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 CoreEx.Events@4.0.0-preview-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=CoreEx.Events&version=4.0.0-preview-1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=CoreEx.Events&version=4.0.0-preview-1&prerelease
                    
Install as a Cake Tool

CoreEx.Events

Provides the CoreEx event publishing and subscribing infrastructure: EventData ↔ CloudEvents formatting, a two-phase queue-then-publish pipeline, and configurable subscriber dispatch with structured error handling.

Overview

CoreEx.Events is the messaging backbone of the CoreEx framework. It defines the contracts and base implementations used by every host that sends or receives integration events — whether those are Azure Service Bus messages, outbox-relayed events, or any other transport.

Publishing follows a two-phase pattern: application code buffers EventData (or CloudEvent) objects into a lightweight in-process queue, then a single PublishAsync() call drains the queue to the underlying transport atomically. An IDestinationProvider resolves topic/queue names from event metadata, and IEventFormatter converts between EventData and the CloudNative CloudEvents specification, attaching distributed tracing headers automatically.

Subscribing is built around EventSubscriberBase, which receives a CloudEvent from the host transport, converts it back to EventData via IEventFormatter, and dispatches to the matching SubscribedBase handler registered with a SubscribedManager. Every error path — transient retries, dead-letter, silent completion, catastrophic failure — is expressed as a configurable ErrorHandling enum value, keeping subscriber code free of try/catch scaffolding.

Key capabilities

  • 🔄 EventData ↔ CloudEvents bridge: IEventFormatter / EventFormatter convert between the CoreEx EventData envelope and the CloudNative CloudEvents spec, including distributed-tracing header propagation (traceparent, tracestate, baggage).
  • 📤 Queue-then-publish pipeline: Events are buffered in-process and dispatched atomically via PublishAsync(); Rollback(count) and Reset() support outbox and retry patterns.
  • 📍 Destination resolution: IDestinationProvider dynamically generates topic/queue names from an EventData, an explicit destination string, or from MessageType and domain name.
  • 📥 Structured subscriber dispatch: SubscribedManager routes incoming events to [Subscribe]-decorated handlers, enforces inbox idempotency checks, and manages ambiguous- and not-subscribed outcomes.
  • 🛡️ Configurable error handling: ErrorHandling enum values (CompleteAsSilent, Retry, DeadLetter, Catastrophic, and more) are mapped per exception type via a fluent ErrorHandler configurator — no boilerplate try/catch in subscriber code.
  • 📊 OpenTelemetry metrics: EventSubscriberMetrics exposes a messages.received counter via System.Diagnostics.Metrics; EventPublisherInvoker and SubscribedInvoker wrap operations in activity spans.
  • 🧩 MessageType discrimination: Distinguishes Event, Command, and ReplyTo semantics for destination-name generation.

Key types

Type Description
IEventFormatter Formats/parses EventData, converts to/from CloudEvent, adds distributed-tracing headers.
EventFormatter Default IEventFormatter implementation; handles CloudEvents attribute mapping and trace propagation.
MessageType Enum: Event, Command, ReplyTo — used in destination-name generation.

Namespaces

Namespace Description Documentation
CoreEx.Events.Publishing Two-phase queue-then-publish pipeline: IEventQueue, IEventPublisher, EventPublisherBase, IDestinationProvider, DestinationEvent, NoOpEventPublisher. 📖 README
CoreEx.Events.Subscribing Subscriber dispatch and error handling: EventSubscriberBase, SubscribedManager, SubscribedBase, ErrorHandler, ErrorHandling, subscriber exceptions. 📖 README
  • CoreEx - Defines EventData, CloudEvent interop, ExecutionContext, and Result<T> used throughout the events pipeline.
  • CoreEx.Database.Outbox - Outbox-pattern publisher that wraps IEventPublisher; persists events transactionally and relays them via a background relay host.
  • CoreEx.DomainDriven - Aggregate<TId, TSelf> accumulates EventData internally; the application layer forwards those to the publishing queue within the same unit-of-work.
  • CoreEx.Invokers - EventPublisherInvoker and SubscribedInvoker provide OpenTelemetry activity wrapping for publish and receive operations.

AI Usage Guide

An AGENTS.md file is included with this package. AI coding assistants (GitHub Copilot, Claude, Cursor, etc.) that support workspace-injected package documentation will automatically surface concise usage guidance, code examples, and Do Not rules for this package without requiring a local CoreEx checkout.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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 (4)

Showing the top 4 NuGet packages that depend on CoreEx.Events:

Package Downloads
CoreEx.UnitTesting

Core .NET extensions and abstractions for the testing of backend services.

CoreEx.Data

Core .NET extensions and abstractions for the development of backend services.

CoreEx.DomainDriven

Core .NET extensions and abstractions for the development of backend services.

CoreEx.Azure.Messaging.ServiceBus

Core .NET extensions and abstractions for the development of backend services.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.0-preview-1 41 6/20/2026