Lyo.MessageQueue 2.0.0

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

Lyo.MessageQueue

IMqService defines the queue and exchange contract. Schedulers, workers, and gateways compile against one interface and swap RabbitMQ or later brokers behind Lyo.MessageQueue.* implementations.

Implements Lyo.Health.IHealth so dashboards can ping broker connectivity alongside DB/cache checks.

IMqService

  • ConnectAsync / DisconnectAsync open and close a session.
  • IsConnected is a synchronous snapshot used as a guard.

Message envelopes (QueueMessageEnvelope<T>)

QueueMessageEnvelope<T> holds Payload, RequeueCount, MessageId, EnqueuedAt, TraceId, and Version alongside the payload. The internal QueueWorkerHelpers.DeserializeMessage<T> detects JSON shaped like { Payload, RequeueCount, … } vs raw DTO JSON so you can:

  • Attach RequeueCount / identifiers / timestamps without wrapping every caller manually.
  • Migrate legacy producers that still emit bare JSON objects. The first requeue from a legacy message is wrapped in an envelope by QueueWorkerBase so subsequent requeues count correctly.

MessageProcessingExceptionHandling (IgnoreAndRemoveFromQueue, ThrowAndRemoveFromQueue, RequeueOnException) is the shared enum implementations expose for tuning how thrown exceptions in message handlers map onto ack/nack/requeue.

QueueWorkerBase

  • Implements IHostedService + IDisposable + IHealth. StartAsync connects when needed and calls SubscribeToQueue. StopAsync cancels, then waits up to DrainTimeoutMs (default 30_000 ms) for in-flight messages, then returns.
  • Parses messages with the envelope-aware DeserializeMessage helper.
  • Executes your abstract DoWorkAsync(TRequest, CancellationToken) → Task<TResult>.
  • Applies requeue heuristics: an optional Metadata["requeue"] bool on the result overrides the default !IsSuccess requeue rule.
  • Supports maxRequeueCount + optional DLQ publish (dlqName); when the count is exceeded, original message bytes go to the DLQ if one is configured; otherwise the message is dropped at Error level.
  • Optional retry backoff through the public RequeueDelay property: when set and the transport implements IDelayedMqService, each counted requeue is republished with a broker-side delay of RequeueDelay × attempt (linear backoff), so a failing message cannot burn through its retry budget in milliseconds. Transports without delay support republish immediately.

Retry path for envelopes

Each failure path acks the original delivery and republishes a counted copy. A bad message or a repeatedly-throwing DoWorkAsync cannot loop forever on broker redelivery:

flowchart LR
    msg[Message delivered] --> des{Deserialize\nautocorrect ladder}
    des -->|unrecoverable| poison[Ack + forward original bytes to DLQ]
    des -->|ok| work[DoWorkAsync]
    work -->|success| ack[Ack]
    work -->|failure / exception| cap{RequeueCount < max?}
    cap -->|yes| requeue["Ack + republish with RequeueCount+1\n(delayed by RequeueDelay × attempt when supported)"]
    requeue --> msg
    cap -->|no| dlq[Ack + route to DLQ or drop]

QueueWorkerOptions

Shared defaults come from DI registration paths (for example AddJobWorker / AddJobWorkerFromConfiguration, section name "QueueWorkerOptions"). The QueueWorkerBase constructor signature is unchanged:

Property Type Default Purpose
DefaultMaxRequeueCount int? 5 Requeue cap applied when a worker doesn't pass an explicit maxRequeueCount. null means unlimited retries.
RequeueDelay TimeSpan? 2s Base retry delay (linear backoff by attempt). Needs an IDelayedMqService transport; null/zero means no delay.
  • Tracks InFlightCount, publishes a queue-worker:{QueueName} health probe via CheckHealthAsync, and emits metrics via the injected IMetrics:
    • queue.worker.message.processing.duration (timer; tag queue)
    • queue.worker.messages.received / processed / requeued / deserialization.failed / dropped.max_requeue / dlq
    • queue.worker.started / start.failed / stopped
    • queue.worker.running (gauge; 1 while running, 0 after stop)
    • Error records on queue.worker.message.processing.error and queue.worker.message.deserialization.error

Lyo job and email workers use this hosted-consumer path.

Health and diagnostics data

  • MqServiceHealth. Queues and Connections collections.
  • MessageQueueInfo(Name, State?, Type?, Messages, MessagesReady, MessagesUnacknowledged, Consumers, AdditionalProperties). Snapshot of one queue. AMQP declare flags (durable, exclusive, auto_delete) and x-* arguments are RabbitMQ-only and sit in AdditionalProperties.
  • MessageExchangeInfo(Name, Type?, Durable, AutoDelete, Internal, AdditionalProperties). Per-exchange snapshot.
  • ConnectionInfo(User, UserProvidedName?, State, VHost). Snapshot of a connection.
  • QueuePeekMessage(Payload, PayloadEncoding?, Exchange?, RoutingKey?, MessageCount?, Redelivered). Returned by PeekQueueMessages.

Operations

  • Treat byte[] as opaque on the interface. Sign and compress at the app layer when payloads leave a trust zone.
  • Idempotency. Requeue storms show up when handlers throw. Keep side effects idempotent or persist processing tokens.
  • Health. Implementors should make IHealth report broker reachability. Do not report healthy while IsConnected() is false unless you want a lazy connect.

Implementations and UI

Package Role
Lyo.MessageQueue.RabbitMq RabbitMQ.Client driver plus DI helpers.
Lyo.MessageQueue.Web.Components Blazor UI for inspecting and managing queues in internal tools.
Lyo.MessageQueue.RabbitMq.Web.Components Rabbit-specific components and registration.

Dependencies

Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).

  • Lyo.Common.Json (direct, lyo)
  • Lyo.Exceptions (direct, lyo)
  • Lyo.Health (direct, lyo)
  • Lyo.Metrics (direct, lyo)
  • Lyo.Result (direct, lyo)
  • Microsoft.Extensions.Hosting.Abstractions 10.0.5 (direct, microsoft)
  • Lyo.Common.Core (transitive, lyo)
  • Microsoft.Bcl.AsyncInterfaces 10.0.5 (transitive, microsoft, netstandard2.0)
  • System.Memory 4.6.3 (transitive, microsoft, netstandard2.0)
  • System.Text.Json 10.0.5 (transitive, microsoft, netstandard2.0)
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (9)

Showing the top 5 NuGet packages that depend on Lyo.MessageQueue:

Package Downloads
Lyo.MessageQueue.RabbitMq

RabbitMQ implementation of the Lyo MessageQueue service for asynchronous messaging.

Lyo.Job.Client

HTTP client for the Lyo Job API and IMqService-backed job event publisher for scheduler/worker hosts.

Lyo.MessageQueue.Web.Components

Reusable Blazor components for provider-neutral message queue dashboards and workbenches.

Lyo.Job.Postgres

PostgreSQL persistence for Lyo job management with EF Core, optional auto-migrations, and RabbitMQ event publishing.

Lyo.Job.Worker

Worker SDK for the Lyo job system. Provides a base class that handles job lifecycle (fetch, start, execute, finish, cancellation) so workers only implement ExecuteAsync.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 105 9/9/2026
1.0.13 238 8/25/2026
1.0.11 240 8/23/2026
1.0.9 271 8/22/2026
1.0.7 228 8/22/2026
1.0.6 297 8/20/2026
1.0.4 353 8/20/2026
1.0.3 277 8/19/2026
1.0.2 286 8/19/2026
1.0.1 269 8/18/2026
1.0.0 236 8/16/2026