public void Configure() { var channel = _config.Channel(); var retryDomainEventExchange = RabbitMqExchangeNameFormatter.Retry(_domainEventExchange); var deadLetterDomainEventExchange = RabbitMqExchangeNameFormatter.DeadLetter(_domainEventExchange); channel.ExchangeDeclare(_domainEventExchange, ExchangeType.Topic); channel.ExchangeDeclare(retryDomainEventExchange, ExchangeType.Topic); channel.ExchangeDeclare(deadLetterDomainEventExchange, ExchangeType.Topic); foreach (var subscriberInformation in _domainEventSubscribersInformation.All()) { var domainEventsQueueName = RabbitMqQueueNameFormatter.Format(subscriberInformation); var retryQueueName = RabbitMqQueueNameFormatter.FormatRetry(subscriberInformation); var deadLetterQueueName = RabbitMqQueueNameFormatter.FormatDeadLetter(subscriberInformation); var subscribedEvent = EventNameSubscribed(subscriberInformation); var queue = channel.QueueDeclare(queue: domainEventsQueueName, durable: true, exclusive: false, autoDelete: false); var retryQueue = channel.QueueDeclare(queue: retryQueueName, (bool)true, (bool)false, (bool)false, (IDictionary <string, object>)RetryQueueArguments(_domainEventExchange, domainEventsQueueName)); var deadLetterQueue = channel.QueueDeclare(queue: deadLetterQueueName, durable: true, exclusive: false, autoDelete: false); channel.QueueBind(queue, _domainEventExchange, domainEventsQueueName); channel.QueueBind(retryQueue, retryDomainEventExchange, domainEventsQueueName); channel.QueueBind(deadLetterQueue, deadLetterDomainEventExchange, domainEventsQueueName); channel.QueueBind(queue, _domainEventExchange, subscribedEvent); } }
public void Configure() { var channel = _config.Channel(); var retryDomainEventExchange = RabbitMqExchangeNameFormatter.Retry(_domainEventExchange); var deadLetterDomainEventExchange = RabbitMqExchangeNameFormatter.DeadLetter(_domainEventExchange); channel.ExchangeDeclare(_domainEventExchange, ExchangeType.Topic); channel.ExchangeDeclare(retryDomainEventExchange, ExchangeType.Topic); channel.ExchangeDeclare(deadLetterDomainEventExchange, ExchangeType.Topic); foreach (var subscriberInformation in _domainEventSubscribersInformation.All()) { var domainEventsQueueName = RabbitMqQueueNameFormatter.Format(subscriberInformation); var retryQueueName = RabbitMqQueueNameFormatter.FormatRetry(subscriberInformation); var deadLetterQueueName = RabbitMqQueueNameFormatter.FormatDeadLetter(subscriberInformation); var subscribedEvent = EventNameSubscribed(subscriberInformation); var queue = channel.QueueDeclare(domainEventsQueueName, true, false, false); var retryQueue = channel.QueueDeclare(retryQueueName, true, false, false, RetryQueueArguments(_domainEventExchange, domainEventsQueueName)); var deadLetterQueue = channel.QueueDeclare(deadLetterQueueName, true, false, false); channel.QueueBind(queue, _domainEventExchange, domainEventsQueueName); channel.QueueBind(retryQueue, retryDomainEventExchange, domainEventsQueueName); channel.QueueBind(deadLetterQueue, deadLetterDomainEventExchange, domainEventsQueueName); channel.QueueBind(queue, _domainEventExchange, subscribedEvent); } }