chibenwa commented on a change in pull request #880:
URL: https://github.com/apache/james-project/pull/880#discussion_r801513006



##########
File path: 
server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/RequeueThrottlingIntegrationTest.java
##########
@@ -0,0 +1,166 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.transport.mailets;
+
+import static 
org.apache.james.mailets.configuration.CommonProcessors.ERROR_REPOSITORY;
+import static org.apache.james.mailets.configuration.Constants.DEFAULT_DOMAIN;
+import static org.apache.james.mailets.configuration.Constants.LOCALHOST_IP;
+import static org.apache.james.mailets.configuration.Constants.PASSWORD;
+import static 
org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
+
+import java.io.File;
+import java.util.stream.IntStream;
+
+import javax.mail.internet.MimeMessage;
+
+import org.apache.james.core.builder.MimeMessageBuilder;
+import org.apache.james.mailets.TemporaryJamesServer;
+import org.apache.james.mailets.configuration.CommonProcessors;
+import org.apache.james.mailets.configuration.MailetConfiguration;
+import org.apache.james.mailets.configuration.MailetContainer;
+import org.apache.james.mailets.configuration.ProcessorConfiguration;
+import org.apache.james.modules.protocols.ImapGuiceProbe;
+import org.apache.james.modules.protocols.SmtpGuiceProbe;
+import org.apache.james.rate.limiter.memory.MemoryRateLimiterModule;
+import org.apache.james.transport.matchers.All;
+import org.apache.james.utils.DataProbeImpl;
+import org.apache.james.utils.SMTPMessageSender;
+import org.apache.james.utils.TestIMAPClient;
+import org.apache.mailet.base.test.FakeMail;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
+
+import com.github.fge.lambdas.Throwing;
+
+public class RequeueThrottlingIntegrationTest {

Review comment:
       Maybe we can try writing assertions on the received dates of the emails 
to make sure emails were throttled?

##########
File path: 
server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Requeue.java
##########
@@ -34,45 +34,82 @@
 import org.apache.mailet.Mail;
 import org.apache.mailet.base.GenericMailet;
 
-public class RequeueMailet extends GenericMailet {
-    private static final MailQueueName DEFAULT_MAIL_QUEUE_NAME = 
MailQueueFactory.SPOOL;
-    private static final String DEFAULT_PROCESSOR = Mail.TRANSPORT;
-    private static final Duration DEFAULT_DELAY_DURATION = Duration.ofHours(2);
+import com.google.common.base.Preconditions;
 
+/**
+ * <p><b>Requeue</b> allows for a throttling when combined with rate limiting 
mailet. {@link org.apache.james.transport.mailets.PerSenderRateLimit}</p>

Review comment:
       throttling is a usage not the main function of this mailet.
   
   Say "Requeue puts back the email in a queue.
   
   It can be used for throttling when combined with rate limiting mailet."




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to