Quellcode durchsuchen

Fix RabbitMQ polling bug.

master
yangxiaodong vor 7 Jahren
Ursprung
Commit
f184550a7c
2 geänderte Dateien mit 7 neuen und 3 gelöschten Zeilen
  1. +2
    -3
      src/DotNetCore.CAP.RabbitMQ/IProcessor.RabbitJobProcessor.cs
  2. +5
    -0
      src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs

+ 2
- 3
src/DotNetCore.CAP.RabbitMQ/IProcessor.RabbitJobProcessor.cs Datei anzeigen

@@ -136,11 +136,10 @@ namespace DotNetCore.CAP.RabbitMQ
using (var connection = factory.CreateConnection())
using (var channel = connection.CreateModel())
{
channel.ExchangeDeclare(exchange: "topic_logs",
channel.ExchangeDeclare(exchange: "test",
type: "topic");

var body = Encoding.UTF8.GetBytes(content);
channel.BasicPublish(exchange: "topic_logs",
channel.BasicPublish(exchange: "test",
routingKey: topic,
basicProperties: null,
body: body);


+ 5
- 0
src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs Datei anzeigen

@@ -1,5 +1,6 @@
using System;
using System.Text;
using System.Threading.Tasks;
using DotNetCore.CAP.Infrastructure;
using RabbitMQ.Client;
using RabbitMQ.Client.Events;
@@ -53,6 +54,10 @@ namespace DotNetCore.CAP.RabbitMQ
var consumer = new EventingBasicConsumer(_channel);
consumer.Received += OnConsumerReceived;
_channel.BasicConsume(_queueName, true, consumer);
while (true)
{
Task.Delay(timeout);
}
}

public void Subscribe(string topic)


Laden…
Abbrechen
Speichern