private void CleanEnvironment(IModel channel, DomainEventSubscribersInformation information) { channel.ExchangeDelete(TestDomainEvents); foreach (var domainEventSubscriberInformation in information.All()) { channel.QueueDelete(RabbitMqQueueNameFormatter.Format(domainEventSubscriberInformation)); } }
private static void CreateQueue(IModel channel, DomainEventSubscribersInformation domainEventSubscribersInformation) { foreach (var subscriberInformation in domainEventSubscribersInformation.All()) { var domainEventsQueueName = RabbitMqQueueNameFormatter.Format(subscriberInformation); var queue = channel.QueueDeclare(domainEventsQueueName, true, false, false); dynamic domainEvent = Activator.CreateInstance(subscriberInformation.SubscribedEvent); channel.QueueBind(queue, TestDomainEvents, (string)domainEvent.EventName()); } }