Ejemplo n.º 1
0
 public Task Work(RabbitEventBus bus)
 {
     if (eventBusDictionary.TryAdd(bus.EventName, bus))
     {
         eventBusList.Add(bus);
         using var channel = rabbitMQClient.PullChannel();
         channel.Model.ExchangeDeclare($"{rabbitOptions.Prefix}{bus.Exchange}", "direct", true);
         return(Task.CompletedTask);
     }
     else
     {
         throw new EventBusRepeatException(bus.Event.FullName);
     }
 }