Davasorus.Utility.DotNet.SQS
2026.2.1.2
See the version list below for details.
dotnet add package Davasorus.Utility.DotNet.SQS --version 2026.2.1.2
NuGet\Install-Package Davasorus.Utility.DotNet.SQS -Version 2026.2.1.2
<PackageReference Include="Davasorus.Utility.DotNet.SQS" Version="2026.2.1.2" />
<PackageVersion Include="Davasorus.Utility.DotNet.SQS" Version="2026.2.1.2" />
<PackageReference Include="Davasorus.Utility.DotNet.SQS" />
paket add Davasorus.Utility.DotNet.SQS --version 2026.2.1.2
#r "nuget: Davasorus.Utility.DotNet.SQS, 2026.2.1.2"
#:package Davasorus.Utility.DotNet.SQS@2026.2.1.2
#addin nuget:?package=Davasorus.Utility.DotNet.SQS&version=2026.2.1.2
#tool nuget:?package=Davasorus.Utility.DotNet.SQS&version=2026.2.1.2
Davasorus.Utility.DotNet.SQS
Overview
Davasorus.Utility.DotNet.SQS provides utilities for publishing messages to Amazon Simple Queue Service (SQS) from .NET applications. It handles message serialization, error deduplication, anonymization, location enrichment, and OpenTelemetry tracing out of the box.
Features
- Publish messages to AWS SQS FIFO and standard queues
- Built-in error deduplication and anonymous error reporting
- Location enrichment (city, region) via IP geolocation with configurable caching
- OpenTelemetry distributed tracing on all operations
- Secure credential management (decrypts AWS secrets at runtime)
- Fluent configuration with
SqsOptionsBuilderorappsettings.jsonbinding - Designed for dependency injection with a single
AddSqsLogging()call - Service-oriented usage: always interact with
ISqsService, not the client directly
Getting Started
- Reference the library in your .NET 8 project.
- Register services using the
AddSqsLogging()extension method. - Use
ISqsServicein your application code to publish messages.
Dependency Injection
Register all SQS and location services with a single call:
// Default configuration (caching enabled, 1 hour location cache, 4 hour IP cache)
services.AddSqsLogging();
// Fluent configuration
services.AddSqsLogging(sqs => sqs
.WithLocationCache(TimeSpan.FromHours(1))
.WithIpCache(TimeSpan.FromHours(4)));
// Bind from appsettings.json
services.AddSqsLogging(configuration.GetSection("SqsOptions"));
// Hybrid: appsettings with fluent overrides
services.AddSqsLogging(
configuration.GetSection("SqsOptions"),
sqs => sqs.WithLocationCache(TimeSpan.FromMinutes(90)));
AddSqsLogging() registers the following services:
| Service | Lifetime | Purpose |
|---|---|---|
SqsOptions |
Singleton | Configuration options |
IMemoryCache |
Singleton | Backing store for location cache |
LocationCache |
Singleton | IP and location caching |
ILocationClient / LocationClient |
Transient | Fetches location data from external APIs |
ILocationService / LocationService |
Scoped | Location operations interface |
ISqsClient / SqsClient |
Transient | Low-level SQS publishing |
ISqsService / SqsService |
Scoped | High-level SQS operations (use this) |
Only inject and use ISqsService in your application code.
Usage Example
public class MyService
{
private readonly ISqsService _sqsService;
public MyService(ISqsService sqsService) => _sqsService = sqsService;
public async Task LogErrorAsync(string message)
{
var model = new TrelloMessageQueueModel { Message = message /*, ... */ };
await _sqsService.SendLoggingMessage(model);
}
}
Configuration
SqsOptions
Configure caching and error collection behavior via SqsOptions:
| Property | Default | Description |
|---|---|---|
LocationCacheDurationMinutes |
60 | Duration to cache location data (city, region) |
IpAddressCacheDurationMinutes |
240 | Duration to cache the public IP address |
EnableLocationCaching |
true | Enable/disable location caching entirely |
MaxErrorCollectionSize |
1000 | Maximum tracked errors before FIFO eviction |
LocationHttpTimeoutSeconds |
10 | Timeout for external location API calls |
MaxConnectionsPerLocationServer |
2 | Max concurrent connections per location API server |
AWS Credentials
Access Key and Secret Key are stored securely and decrypted at runtime via the IDecrypt service from Davasorus.Utility.DotNet.Encryption.
Queue Names
Queue names are managed internally by the service:
messageQueue.fifo-- general and logging messagesresponseQueue.fifo-- response messagessystemMaint.fifo-- maintenance messagestaskQueue-{hostId}.fifo-- per-host task messagestaskQueue.fifo-- task response messages
Location Service
The package includes a location subsystem for enriching error reports with geographic data.
- LocationCache -- Singleton cache backed by
IMemoryCache. Caches IP addresses and location data with configurable TTLs. - LocationClient -- Fetches the machine's public IP via
api.ipify.organd resolves location viaipinfo.io. Supports cached and uncached modes. - LocationService -- Scoped interface for application code to request location fields.
Supported location fields: "ip", "city", "region", "loc".
var city = await locationService.GetLocationInformation("city");
var region = await locationService.GetLocationInformation("region");
Telemetry
All operations emit OpenTelemetry traces via System.Diagnostics.ActivitySource. Activity sources are created for:
SQS.Service-- high-level publish operationsSQS.Client-- low-level SQS API callsLocation.Service-- location lookupsLocation.Client-- IP and geolocation fetchesLocation.Cache-- cache hits and misses
Traces include semantic messaging conventions (messaging.system, messaging.destination, messaging.message_id) for integration with observability platforms.
Error Handling
- All SQS publish operations catch exceptions internally and return
"error"on failure. - Errors are logged via
ILogger. SendLoggingMessageperforms deduplication: repeated identical errors are not re-published.- When anonymous error reporting is enabled, usernames are stripped from messages and metadata.
API Overview
The ISqsService interface provides the following methods:
Task<string> SendLoggingMessage(TrelloMessageQueueModel message)-- Sends a logging message with deduplication, anonymization, and location enrichment. Returns the message ID on success.Task<string> PublishMessage(TrelloMessageQueueModel message, string messageGroupID = null)-- Publishes a general message. Supports FIFO queue grouping viamessageGroupID.Task<string> PublishResponseMessage(TrelloMessageQueueResponseModel message, string messageGroupID = null)-- Publishes a response message for request/response patterns. Supports FIFO grouping.Task<string> PublishMaintenanceMessage(TrelloMessageQueueModel message, string messageGroupID = null)-- Sends a maintenance message with optional FIFO grouping.Task<string> PublishTaskMessageToClient(RemoteHostTaskQueueModel message, string messageGroupID = null)-- Publishes a task message to a specific remote host's queue.Task<string> PublishTaskMessageResponse(RemoteHostTaskQueueModel message, string messageGroupID = null)-- Publishes a response to a previously sent task message.string GetUserName()-- Returns the current username, or"Anonymous"when anonymous reporting is enabled.string GetMachineName()-- Returns the machine name, or"Anonymous"when anonymous reporting is enabled.string ParseDescription(string text)-- Strips the current username from the provided text for anonymization.
Dependencies
- AWSSDK.SQS
- Davasorus.Utility.DotNet.Contracts.Types
- Davasorus.Utility.DotNet.Contracts.Collections
- Davasorus.Utility.DotNet.Encryption
- Davasorus.Utility.DotNet.Telemetry
- Microsoft.Extensions.Caching.Memory
- Microsoft.Extensions.Http
- Microsoft.Extensions.Logging.Abstractions
- Microsoft.Extensions.Options
License
MIT License
Contributing
Contributions are welcome! Please submit issues or pull requests for improvements.
| Product | Versions 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 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 was computed. 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. |
-
net8.0
- AWSSDK.SQS (>= 4.0.2.24)
- Davasorus.Utility.Dotnet.Contracts.Collections (>= 2026.2.1.4)
- Davasorus.Utility.DotNet.Contracts.Types (>= 2026.2.1.4)
- Davasorus.Utility.DotNet.Encryption (>= 2026.2.1.3)
- Davasorus.Utility.DotNet.Telemetry (>= 2026.2.1.1)
- Microsoft.Extensions.Caching.Memory (>= 10.0.5)
- Microsoft.Extensions.Http (>= 10.0.5)
- Microsoft.Extensions.Logging (>= 10.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Options (>= 10.0.5)
NuGet packages (6)
Showing the top 5 NuGet packages that depend on Davasorus.Utility.DotNet.SQS:
| Package | Downloads |
|---|---|
|
Davasorus.Utility.DotNet.Api
API Interaction for TEPS Utilities with generic deserialization, configurable error reporting, and improved DI configuration. Supports REST, GraphQL, gRPC, WebSocket, SignalR, and SSE protocols. |
|
|
Davasorus.Utility.DotNet.SQL
SQL interaction code for TEPS Utilities |
|
|
Davasorus.Utility.DotNet.Services
Windows Service management (start, stop, enable, disable, enumerate) for TEPS Utilities, with OpenTelemetry tracing and DI-based wiring. Targets .NET 8 and .NET 10. |
|
|
Davasorus.Utility.DotNet.Config
Manipulating config file for TEPS Utilities |
|
|
Davasorus.Utility.DotNet.Caching
UCaching for TEPS Utilities |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.2.2.9 | 239 | 5/31/2026 |
| 2026.2.2.8 | 434 | 5/29/2026 |
| 2026.2.2.7 | 538 | 5/25/2026 |
| 2026.2.2.6 | 1,134 | 5/23/2026 |
| 2026.2.2.4 | 1,336 | 5/15/2026 |
| 2026.2.2.3 | 952 | 5/5/2026 |
| 2026.2.2.2 | 1,049 | 5/1/2026 |
| 2026.2.2.1 | 110 | 5/1/2026 |
| 2026.2.1.4 | 147 | 4/30/2026 |
| 2026.2.1.3 | 198 | 4/16/2026 |
| 2026.2.1.2 | 4,710 | 4/9/2026 |
| 2026.2.1.1 | 1,246 | 4/1/2026 |
| 2026.1.3.6 | 687 | 3/29/2026 |
| 2026.1.3.5 | 859 | 3/24/2026 |
| 2026.1.3.4 | 229 | 3/18/2026 |
| 2026.1.3.3 | 1,330 | 3/12/2026 |
| 2026.1.3.2 | 109 | 3/12/2026 |
| 2026.1.3.1 | 595 | 3/10/2026 |
| 2026.1.2.4 | 1,630 | 2/17/2026 |
| 2026.1.2.2 | 743 | 2/13/2026 |