Beztek.Facade.Queue 1.0.6

dotnet add package Beztek.Facade.Queue --version 1.0.6                
NuGet\Install-Package Beztek.Facade.Queue -Version 1.0.6                
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="Beztek.Facade.Queue" Version="1.0.6" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Beztek.Facade.Queue --version 1.0.6                
#r "nuget: Beztek.Facade.Queue, 1.0.6"                
#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.
// Install Beztek.Facade.Queue as a Cake Addin
#addin nuget:?package=Beztek.Facade.Queue&version=1.0.6

// Install Beztek.Facade.Queue as a Cake Tool
#tool nuget:?package=Beztek.Facade.Queue&version=1.0.6                

Queue Facade Library

This library is intended for high throughput inter-service communication by use of Queues. The source can be found here: https://github.com/Beztek-Software-Solutions/queue-facade

Overview

It is intended to be cloud portable and take advantage of the native managed services in each cloud, such as Azure Queue Storage and AWS Simple Queue Service.

It is a reusable and configurable queue library that can ensure that just one consumer among multiple competing consumers processes each message. If the client fails to confirm processing of the message in a configurable timeout period, the message reappears in the queue for other clients to consume. This library should be available for any micro-service for this use case.

Notes

Every queue within an account must have a unique name. The queue name must be a valid DNS name, and cannot be changed once created. Queue names must confirm to the following rules:

  • A queue name must start with a letter or number, and can only contain letters, numbers, and the dash (-) character.

  • The first and last letters in the queue name must be alphanumeric. The dash (-) character cannot be the first or last character. Consecutive dash characters are not permitted in the queue name.

  • All letters in a queue name must be lowercase.

  • A queue name must be from 3 through 63 characters long.

Steps to use the Queue Facade

  1. Find Azure storage connection string and queue names, or create a new queue by providing a new queue name

  2. Implement callback interface IMessageProcessor

  3. Use QueueClientFactory to create Queue client by passing connection string and at lease one queue name client=QueueClientFactory.GetQueueClient(…)

  4. Use client.Enqueue(…) to send generic message to queue, or client.EnqueueBatchedMessages(...) to send list of messages in batch mode. - Example1: bool result = await client.Enqueue<string>(stringMessage, true, activityId); - Example2: IList<bool> results = await client.Enqueue<string>(stringList, true, activityId); - Example3: List<string> unsentMessages = await client.EnqueueBatchedMessages<string>(stringList, true, activityId); - Notice that example3 batch input stringList in chunks, each chunk includes a sub-list of input. - This not only result in less messages in queue than example2, but also allow consumer(etc. event scheduler) to handle batched messages more efficiently.

  5. Create an instance of IMessageProcessor

  6. Use client.DequeueAndProcess(… callback) to retrieve messages from queue

  7. The callback instance should have the messages

Critical Details

  1. Application handling messages implements IMessageProcessor, if MessageProcessor implementation throws an exception which is Not System.ApplicationException then SimpleQueue will retry the message processor until message processor succeeds.
  2. If MessageProcessor needs to handle some application exceptions such as ValidationException, it should catch and throw System.ApplicationException in order to avoid getting same message again and again.
  3. In the MessageProcessor, we need to use the UnwrappedMessage class and not string, or it will throw an exception.
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Beztek.Facade.Queue:

Package Downloads
Beztek.Facade.Cache

API facade over various distributed and non-distributed caches

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.6 1,838 4/11/2024