CanaisDigitais.QueueManager
1.0.4
See the version list below for details.
dotnet add package CanaisDigitais.QueueManager --version 1.0.4
NuGet\Install-Package CanaisDigitais.QueueManager -Version 1.0.4
<PackageReference Include="CanaisDigitais.QueueManager" Version="1.0.4" />
paket add CanaisDigitais.QueueManager --version 1.0.4
#r "nuget: CanaisDigitais.QueueManager, 1.0.4"
// Install CanaisDigitais.QueueManager as a Cake Addin #addin nuget:?package=CanaisDigitais.QueueManager&version=1.0.4 // Install CanaisDigitais.QueueManager as a Cake Tool #tool nuget:?package=CanaisDigitais.QueueManager&version=1.0.4
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 | Versions 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. |
-
.NETStandard 2.1
- IBMMQDotnetClient (>= 9.3.4)
- LogManager (>= 1.2.2)
- Microsoft.CSharp (>= 4.7.0)
- Newtonsoft.Json (>= 13.0.3)
- RabbitMQ.Client (>= 6.6.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.