コード例 #1
0
        public Task Run(CancellationToken cancellationToken = default)
        {
            console.WriteLine($"Creating delay infrastructure v2..");

            using var connection = connectionFactory.CreateAdministrationConnection();
            using var channel    = connection.CreateModel();

            DelayInfrastructure.Build(channel);

            console.WriteLine("Delay infrastructure v2 created successfully");

            return(Task.CompletedTask);
        }
        public static void Reset(
            this ConventionalRoutingTopology routingTopology,
            ConnectionFactory connectionFactory,
            IEnumerable <string> receivingAddresses,
            IEnumerable <string> sendingAddresses)
        {
            using (var connection = connectionFactory.CreateAdministrationConnection())
                using (var channel = connection.CreateModel())
                {
                    foreach (var address in receivingAddresses.Concat(sendingAddresses))
                    {
                        channel.QueueDelete(address, false, false);
                        channel.ExchangeDelete(address, false);
                    }

                    DelayInfrastructure.TearDown(channel);
                    DelayInfrastructure.Build(channel);

                    routingTopology.Initialize(channel, receivingAddresses, sendingAddresses);
                }
        }