CanaisDigitais.QueueManager 1.0.5

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

// Install CanaisDigitais.QueueManager as a Cake Tool
#tool nuget:?package=CanaisDigitais.QueueManager&version=1.0.5                

QueueManager

Biblioteca para gerenciar mensagens em diferentes sistemas de fila como IBM MQ e RabbitMQ.

Caracter�sticas

  • Suporte para IBM MQ.
  • Suporte para RabbitMQ.
  • F�brica para cria��o f�cil e integrada de servi�os de fila.
  • Estrutura de resultado de opera��o padronizada para mensagens enviadas e recebidas.

Como Usar

1. Configura��o

Primeiramente, crie uma inst�ncia da configura��o desejada: IbmMqConfig para IBM MQ ou RabbitMqConfig para RabbitMQ.

2. Crie uma Inst�ncia do Servi�o de Fila

Use a classe QueueServiceFactory para criar a inst�ncia do servi�o de fila desejado.

var config = new RabbitMqConfig { /* ... propriedades ... */ };
IQueueService queueService = QueueServiceFactory.Create(_logger, config);

3. Envie e receba uma Mensagem

var messageToSend = new BaseMessageSend { /* ... propriedades ... */ };
var sendResult = await queueService.SendMessage(messageToSend);

var receivedResult = await queueService.ReceiveMessage();

Recebendo Mensagens via Consumer

Ambos os servi�os, IBMMQService e RabbitMQService, oferecem uma maneira de come�ar um consumidor que escuta continuamente as mensagens e as processa assim que s�o recebidas.

1. Defina a Fun��o de Processamento de Mensagem

Antes de come�ar o consumidor, voc� precisa definir uma fun��o que ser� chamada para cada mensagem recebida.

async Task ProcessMessage(BaseMessageReceive receivedMessage)
{
    // L�gica de processamento da mensagem aqui
    Console.WriteLine($"Mensagem recebida: {receivedMessage.Payload}");
}

2. �nicie o Consumidor

Use o m�todo StartConsumer para iniciar o consumidor.

var cancellationTokenSource = new CancellationTokenSource();

// Inicia o consumidor
queueService.StartConsumer(ProcessMessage, cancellationTokenSource.Token);

// Para parar o consumidor quando necess�rio
// cancellationTokenSource.Cancel();

Este consumidor continuar� a processar mensagens at� que um sinal de cancelamento seja enviado usando o CancellationToken

Depend�ncias

  • IBM.WMQ
  • RabbitMQ.Client
  • Newtonsoft.Json
  • LogManager.Domain
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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.5 333 11/4/2023
1.0.4 194 11/3/2023