public RabbitProducer( IRabbitMQClient rabbitMQClient, RabbitEventBus publisher) { this.publisher = publisher; this.rabbitMQClient = rabbitMQClient; }
public RabbitProducer( IRabbitMQClient rabbitMQClient, RabbitEventBus publisher, Type grainType) { GrainType = grainType; this.publisher = publisher; this.rabbitMQClient = rabbitMQClient; }
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); } }
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); } }