camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] camel git commit: CAMEL-8933: mail consumer should use the default delay of 60 seconds.
Date Mon, 06 Jul 2015 09:18:20 GMT
CAMEL-8933: mail consumer should use the default delay of 60 seconds.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/86919b06
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/86919b06
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/86919b06

Branch: refs/heads/camel-2.15.x
Commit: 86919b0636414bf922ce541311dfc8bf5e1f7fe4
Parents: 99dce53
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Mon Jul 6 11:24:08 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Mon Jul 6 11:24:38 2015 +0200

----------------------------------------------------------------------
 .../apache/camel/component/mail/MailEndpoint.java    | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/86919b06/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
index 2ab1ce5..49d4e92 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailEndpoint.java
@@ -36,6 +36,8 @@ import org.apache.camel.spi.UriParam;
  */
 @UriEndpoint(scheme = "imap,imaps,pop3,pop3s,smtp,smtps", title = "IMAP,IMAPS,POP3,POP3S,SMTP,SMTPS",
syntax = "imap:host:port", consumerClass = MailConsumer.class, label = "mail")
 public class MailEndpoint extends ScheduledPollEndpoint {
+    @UriParam(defaultValue = "" + MailConsumer.DEFAULT_CONSUMER_DELAY, label = "consumer",
description = "Milliseconds before the next poll.")
+    private long delay = MailConsumer.DEFAULT_CONSUMER_DELAY;
     @UriParam
     private MailConfiguration configuration;
     @UriParam
@@ -54,21 +56,27 @@ public class MailEndpoint extends ScheduledPollEndpoint {
     private MailBoxPostProcessAction postProcessAction;
 
     public MailEndpoint() {
+        // ScheduledPollConsumer default delay is 500 millis and that is too often for polling
a mailbox,
+        // so we override with a new default value. End user can override this value by providing
a consumer.delay parameter
+        setDelay(MailConsumer.DEFAULT_CONSUMER_DELAY);
     }
 
     public MailEndpoint(String uri, MailComponent component, MailConfiguration configuration)
{
         super(uri, component);
         this.configuration = configuration;
+        setDelay(MailConsumer.DEFAULT_CONSUMER_DELAY);
     }
 
     @Deprecated
     public MailEndpoint(String endpointUri, MailConfiguration configuration) {
         super(endpointUri);
         this.configuration = configuration;
+        setDelay(MailConsumer.DEFAULT_CONSUMER_DELAY);
     }
 
     public MailEndpoint(String endpointUri) {
         this(endpointUri, new MailConfiguration());
+        setDelay(MailConsumer.DEFAULT_CONSUMER_DELAY);
     }
 
     public Producer createProducer() throws Exception {
@@ -103,17 +111,10 @@ public class MailEndpoint extends ScheduledPollEndpoint {
      */
     public Consumer createConsumer(Processor processor, JavaMailSender sender) throws Exception
{
         MailConsumer answer = new MailConsumer(this, processor, sender);
-
         answer.setHandleFailedMessage(configuration.isHandleFailedMessage());
         answer.setSkipFailedMessage(configuration.isSkipFailedMessage());
-
-        // ScheduledPollConsumer default delay is 500 millis and that is too often for polling
a mailbox,
-        // so we override with a new default value. End user can override this value by providing
a consumer.delay parameter
-        answer.setDelay(MailConsumer.DEFAULT_CONSUMER_DELAY);
-
         answer.setMaxMessagesPerPoll(getMaxMessagesPerPoll());
         configureConsumer(answer);
-
         return answer;
     }
 


Mime
View raw message