james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [2/4] james-project git commit: JAMES-1727 Sending mail from a mailetContext should append to the mailQueue
Date Thu, 19 May 2016 10:06:09 GMT
JAMES-1727 Sending mail from a mailetContext should append to the mailQueue


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/7d2ef261
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/7d2ef261
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/7d2ef261

Branch: refs/heads/master
Commit: 7d2ef26134a960ebf2cbca0734661029ffaa300d
Parents: 6090fa4
Author: Benoit Tellier <btellier@linagora.com>
Authored: Tue Apr 26 15:05:29 2016 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Thu May 19 10:18:18 2016 +0700

----------------------------------------------------------------------
 .../modules/server/CamelMailetContainerModule.java    |  6 +++---
 .../mailetcontainer/impl/JamesMailetContext.java      | 14 ++++++--------
 2 files changed, 9 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/7d2ef261/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
index 3974f8f..b3aede8 100644
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
+++ b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
@@ -32,6 +32,7 @@ import org.apache.james.mailetcontainer.api.jmx.MailSpoolerMBean;
 import org.apache.james.mailetcontainer.impl.JamesMailSpooler;
 import org.apache.james.mailetcontainer.impl.JamesMailetContext;
 import org.apache.james.mailetcontainer.impl.camel.CamelCompositeProcessor;
+import org.apache.james.queue.api.MailQueueFactory;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.james.utils.ConfigurationPerformer;
 import org.apache.james.utils.ConfigurationProvider;
@@ -66,14 +67,14 @@ public class CamelMailetContainerModule extends AbstractModule {
 
     @Provides
     @Singleton
-    private MailetContext provideMailetContext(MailProcessor processorList,
+    private MailetContext provideMailetContext(MailQueueFactory mailQueueFactory,
                                                     DNSService dns,
                                                     UsersRepository localusers,
                                                     DomainList domains) {
         JamesMailetContext jamesMailetContext = new JamesMailetContext();
         jamesMailetContext.setLog(MAILET_LOGGER);
         jamesMailetContext.setDNSService(dns);
-        jamesMailetContext.setMailProcessor(processorList);
+        jamesMailetContext.retrieveRootMailQueue(mailQueueFactory);
         jamesMailetContext.setUsersRepository(localusers);
         jamesMailetContext.setDomainList(domains);
         return jamesMailetContext;
@@ -110,7 +111,6 @@ public class CamelMailetContainerModule extends AbstractModule {
                 jamesMailSpooler.init();
                 mailetContext.setLog(MAILET_LOGGER);
                 mailetContext.configure(configurationProvider.getConfiguration("mailetcontainer").configurationAt("context"));
-                mailetContext.setMailProcessor(camelCompositeProcessor);
             } catch (Exception e) {
                 Throwables.propagate(e);
             }

http://git-wip-us.apache.org/repos/asf/james-project/blob/7d2ef261/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailetContext.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailetContext.java
b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailetContext.java
index 732a303..7afe0b5 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailetContext.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/JamesMailetContext.java
@@ -51,7 +51,8 @@ import org.apache.james.domainlist.api.DomainListException;
 import org.apache.james.lifecycle.api.Configurable;
 import org.apache.james.lifecycle.api.LifecycleUtil;
 import org.apache.james.lifecycle.api.LogEnabled;
-import org.apache.james.mailetcontainer.api.MailProcessor;
+import org.apache.james.queue.api.MailQueue;
+import org.apache.james.queue.api.MailQueueFactory;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.james.user.api.UsersRepositoryException;
 import org.apache.mailet.HostAddress;
@@ -75,15 +76,15 @@ public class JamesMailetContext implements MailetContext, LogEnabled,
Configurab
 
     private UsersRepository localusers;
 
-    private MailProcessor processorList;
+    private MailQueue rootMailQueue;
 
     private DomainList domains;
 
     private MailAddress postmaster;
 
     @Inject
-    public void setMailProcessor(MailProcessor processorList) {
-        this.processorList = processorList;
+    public void retrieveRootMailQueue(MailQueueFactory mailQueueFactory) {
+        this.rootMailQueue = mailQueueFactory.getQueue(MailQueueFactory.SPOOL);
     }
 
     @Inject
@@ -402,12 +403,9 @@ public class JamesMailetContext implements MailetContext, LogEnabled,
Configurab
         sendMail(sender, recipients, message, Mail.DEFAULT);
     }
 
-    /**
-     * TODO: Should we use the MailProcessorList or the MailQueue here ?
-     */
     @Override
     public void sendMail(Mail mail) throws MessagingException {
-        processorList.service(mail);
+        rootMailQueue.enQueue(mail);
     }
 
     public void sendMail(MailAddress sender, Collection<MailAddress> recipients, MimeMessage
message, String state) throws MessagingException {


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message