james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [2/3] james-project git commit: JAMES-2537 Load RabbitMQ configuration in Cassandra Guice base products
Date Thu, 06 Sep 2018 13:30:02 GMT
JAMES-2537 Load RabbitMQ configuration in Cassandra Guice base products


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

Branch: refs/heads/master
Commit: 6a44a81eda7c6533943d2141d9a7ceb20f8b70c9
Parents: bb9c0a3
Author: Antoine Duprat <aduprat@linagora.com>
Authored: Tue Sep 4 16:18:24 2018 +0200
Committer: Antoine Duprat <aduprat@linagora.com>
Committed: Thu Sep 6 15:29:38 2018 +0200

----------------------------------------------------------------------
 .../destination/conf/rabbitmq.properties        |  1 +
 .../destination/conf/rabbitmq.properties        |  1 +
 server/container/guice/cassandra-guice/pom.xml  |  4 ++
 .../apache/james/CassandraJamesServerMain.java  |  4 +-
 .../src/test/resources/rabbitmq.properties      |  1 +
 server/container/guice/pom.xml                  |  6 +++
 server/container/guice/rabbitmq/pom.xml         | 49 +++++++++++++++++
 .../james/modules/rabbitmq/RabbitMQModule.java  | 56 ++++++++++++++++++++
 8 files changed, 121 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/6a44a81e/dockerfiles/run/guice/cassandra-ldap/destination/conf/rabbitmq.properties
----------------------------------------------------------------------
diff --git a/dockerfiles/run/guice/cassandra-ldap/destination/conf/rabbitmq.properties b/dockerfiles/run/guice/cassandra-ldap/destination/conf/rabbitmq.properties
new file mode 100644
index 0000000..216956e
--- /dev/null
+++ b/dockerfiles/run/guice/cassandra-ldap/destination/conf/rabbitmq.properties
@@ -0,0 +1 @@
+uri=amqp://james:james@rabbitmq_host:5672
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a44a81e/dockerfiles/run/guice/cassandra/destination/conf/rabbitmq.properties
----------------------------------------------------------------------
diff --git a/dockerfiles/run/guice/cassandra/destination/conf/rabbitmq.properties b/dockerfiles/run/guice/cassandra/destination/conf/rabbitmq.properties
new file mode 100644
index 0000000..216956e
--- /dev/null
+++ b/dockerfiles/run/guice/cassandra/destination/conf/rabbitmq.properties
@@ -0,0 +1 @@
+uri=amqp://james:james@rabbitmq_host:5672
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a44a81e/server/container/guice/cassandra-guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/pom.xml b/server/container/guice/cassandra-guice/pom.xml
index 6c44d10..896c2f0 100644
--- a/server/container/guice/cassandra-guice/pom.xml
+++ b/server/container/guice/cassandra-guice/pom.xml
@@ -163,6 +163,10 @@
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-guice-rabbitmq</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
             <artifactId>james-server-guice-smtp</artifactId>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a44a81e/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
index 4a97ab3..4a1b8ca 100644
--- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
+++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
@@ -42,6 +42,7 @@ import org.apache.james.modules.protocols.ManageSieveServerModule;
 import org.apache.james.modules.protocols.POP3ServerModule;
 import org.apache.james.modules.protocols.ProtocolHandlerModule;
 import org.apache.james.modules.protocols.SMTPServerModule;
+import org.apache.james.modules.rabbitmq.RabbitMQModule;
 import org.apache.james.modules.server.ActiveMQQueueModule;
 import org.apache.james.modules.server.CassandraRoutesModule;
 import org.apache.james.modules.server.DLPRoutesModule;
@@ -106,7 +107,8 @@ public class CassandraJamesServerMain {
         new ElasticSearchMetricReporterModule(),
         new MailboxModule(),
         new TikaMailboxModule(),
-        new SpamAssassinListenerModule());
+        new SpamAssassinListenerModule(),
+        new RabbitMQModule());
 
     public static Module ALL_BUT_JMX_CASSANDRA_MODULE = Modules.combine(
         CASSANDRA_SERVER_CORE_MODULE,

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a44a81e/server/container/guice/cassandra-guice/src/test/resources/rabbitmq.properties
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/resources/rabbitmq.properties
b/server/container/guice/cassandra-guice/src/test/resources/rabbitmq.properties
new file mode 100644
index 0000000..216956e
--- /dev/null
+++ b/server/container/guice/cassandra-guice/src/test/resources/rabbitmq.properties
@@ -0,0 +1 @@
+uri=amqp://james:james@rabbitmq_host:5672
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a44a81e/server/container/guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml
index be8644d..41c0a9a 100644
--- a/server/container/guice/pom.xml
+++ b/server/container/guice/pom.xml
@@ -65,6 +65,7 @@
         <module>protocols/webadmin-mailqueue</module>
         <module>protocols/webadmin-mailrepository</module>
         <module>protocols/webadmin-swagger</module>
+        <module>rabbitmq</module>
     </modules>
 
     <dependencyManagement>
@@ -132,6 +133,11 @@
             </dependency>
             <dependency>
                 <groupId>${james.groupId}</groupId>
+                <artifactId>james-server-guice-rabbitmq</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${james.groupId}</groupId>
                 <artifactId>james-server-guice-smtp</artifactId>
                 <version>${project.version}</version>
             </dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a44a81e/server/container/guice/rabbitmq/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/rabbitmq/pom.xml b/server/container/guice/rabbitmq/pom.xml
new file mode 100644
index 0000000..25a8e64
--- /dev/null
+++ b/server/container/guice/rabbitmq/pom.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.james</groupId>
+        <artifactId>james-server-guice</artifactId>
+        <version>3.2.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>james-server-guice-rabbitmq</artifactId>
+
+    <name>Apache James :: Server :: Guice :: RabbitMQ</name>
+    <description>Guice Module for RabbitMQ</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>apache-james-backends-rabbitmq</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-guice-configuration</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.inject</groupId>
+            <artifactId>guice</artifactId>
+        </dependency>
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a44a81e/server/container/guice/rabbitmq/src/main/java/org/apache/james/modules/rabbitmq/RabbitMQModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/rabbitmq/src/main/java/org/apache/james/modules/rabbitmq/RabbitMQModule.java
b/server/container/guice/rabbitmq/src/main/java/org/apache/james/modules/rabbitmq/RabbitMQModule.java
new file mode 100644
index 0000000..eb61313
--- /dev/null
+++ b/server/container/guice/rabbitmq/src/main/java/org/apache/james/modules/rabbitmq/RabbitMQModule.java
@@ -0,0 +1,56 @@
+/****************************************************************
+ * 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.modules.rabbitmq;
+
+import java.io.FileNotFoundException;
+
+import javax.inject.Singleton;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.james.backend.mailqueue.RabbitMQConfiguration;
+import org.apache.james.utils.PropertiesProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+
+public class RabbitMQModule extends AbstractModule {
+
+    public static final String RABBITMQ_CONFIGURATION_NAME = "rabbitmq";
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(RabbitMQModule.class);
+
+    @Override
+    protected void configure() {
+    }
+
+    @Provides
+    @Singleton
+    private RabbitMQConfiguration getMailQueueConfiguration(PropertiesProvider propertiesProvider)
throws ConfigurationException {
+        try {
+            PropertiesConfiguration configuration = propertiesProvider.getConfiguration(RABBITMQ_CONFIGURATION_NAME);
+            return RabbitMQConfiguration.from(configuration);
+        } catch (FileNotFoundException e) {
+            LOGGER.error("Could not find " + RABBITMQ_CONFIGURATION_NAME + " configuration
file.");
+            throw new RuntimeException(e);
+        }
+    }
+}


---------------------------------------------------------------------
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