QueueManager 1.0.2

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

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

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 net6.0 is compatible.  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. 
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.2 245 11/3/2023