public Task CancelSchedule(Guid messageId) { using var connection = connectionFactory.CreateConnection(); using var channel = connection.CreateModel(); channel.QueueDelete(PostponeMq.InputQueueName(messageId)); channel.ExchangeDelete(PostponeMq.InputExchangeName(messageId)); return(Task.CompletedTask); }
private static void EnsureTopology(IModel channel, Guid messageId, TimeSpan timeout) { var exchangeName = PostponeMq.InputExchangeName(messageId); var queueName = PostponeMq.InputQueueName(messageId); channel.ExchangeDeclare(PostponeMq.OutputExchangeName, ExchangeType.Topic, true); channel.ExchangeDeclare(exchangeName, ExchangeType.Topic, true); channel.QueueDeclare(queueName, true, false, false, new Dictionary <string, object> { ["x-dead-letter-exchange"] = PostponeMq.OutputExchangeName, ["x-message-ttl"] = (int)timeout.TotalMilliseconds }); channel.QueueBind(queueName, exchangeName, "#"); }