示例#1
0
 public RabbitProducer(
     IRabbitMQClient rabbitMQClient,
     RabbitEventBus publisher)
 {
     this.publisher      = publisher;
     this.rabbitMQClient = rabbitMQClient;
 }
示例#2
0
 public RabbitProducer(
     IRabbitMQClient rabbitMQClient,
     RabbitEventBus publisher,
     Type grainType)
 {
     GrainType           = grainType;
     this.publisher      = publisher;
     this.rabbitMQClient = rabbitMQClient;
 }
示例#3
0
 public async Task Work(RabbitEventBus bus)
 {
     eventBusDictionary.TryAdd(bus.ProducerType, bus);
     eventBusList.Add(bus);
     using (var channel = await rabbitMQClient.PullModel())
     {
         channel.Model.ExchangeDeclare(bus.Exchange, "direct", true);
     }
 }
示例#4
0
        public async Task Work(RabbitEventBus bus)
        {
            if (eventBusDictionary.TryAdd(bus.ProducerType, bus))
            {
                eventBusList.Add(bus);
                using var channel = await rabbitMQClient.PullModel();

                channel.Model.ExchangeDeclare(bus.Exchange, "direct", true);
            }
            else
            {
                throw new EventBusRepeatException(bus.ProducerType.FullName);
            }
        }