Explorar el Código

Fix RabbitMQ polling bug.

master
yangxiaodong hace 7 años
padre
commit
f184550a7c
Se han modificado 2 ficheros con 7 adiciones y 3 borrados
  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 Ver fichero

@@ -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 Ver fichero

@@ -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)


Cargando…
Cancelar
Guardar