You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ad...@apache.org on 2018/09/06 13:30:01 UTC
[1/3] james-project git commit: JAMES-2537 Add management uri in
RabbitMQ configuration
Repository: james-project
Updated Branches:
refs/heads/master 9d086021c -> 269e35915
JAMES-2537 Add management uri in RabbitMQ configuration
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/269e3591
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/269e3591
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/269e3591
Branch: refs/heads/master
Commit: 269e35915cec68035b2f55462ca34e9c24de22e2
Parents: 6a44a81
Author: Antoine Duprat <ad...@linagora.com>
Authored: Wed Sep 5 11:31:46 2018 +0200
Committer: Antoine Duprat <ad...@linagora.com>
Committed: Thu Sep 6 15:29:38 2018 +0200
----------------------------------------------------------------------
.../mailqueue/RabbitMQConfiguration.java | 22 +++++++--
.../mailqueue/RabbitMQConfigurationTest.java | 52 ++++++++++++++++++++
.../destination/conf/rabbitmq.properties | 3 +-
.../destination/conf/rabbitmq.properties | 3 +-
.../src/test/resources/rabbitmq.properties | 3 +-
5 files changed, 76 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/269e3591/backends-common/rabbitmq/src/main/java/org/apache/james/backend/mailqueue/RabbitMQConfiguration.java
----------------------------------------------------------------------
diff --git a/backends-common/rabbitmq/src/main/java/org/apache/james/backend/mailqueue/RabbitMQConfiguration.java b/backends-common/rabbitmq/src/main/java/org/apache/james/backend/mailqueue/RabbitMQConfiguration.java
index 98283e4..b36c87a 100644
--- a/backends-common/rabbitmq/src/main/java/org/apache/james/backend/mailqueue/RabbitMQConfiguration.java
+++ b/backends-common/rabbitmq/src/main/java/org/apache/james/backend/mailqueue/RabbitMQConfiguration.java
@@ -29,12 +29,18 @@ import com.google.common.base.Strings;
public class RabbitMQConfiguration {
private static final String URI_PROPERTY_NAME = "uri";
+ private static final String MANAGEMENT_URI_PROPERTY_NAME = "management.uri";
public static RabbitMQConfiguration from(PropertiesConfiguration configuration) {
String uriAsString = configuration.getString(URI_PROPERTY_NAME);
Preconditions.checkState(!Strings.isNullOrEmpty(uriAsString), "You need to specify the URI of RabbitMQ");
URI uri = checkURI(uriAsString);
- return new RabbitMQConfiguration(uri);
+
+ String managementUriAsString = configuration.getString(MANAGEMENT_URI_PROPERTY_NAME);
+ Preconditions.checkState(!Strings.isNullOrEmpty(managementUriAsString), "You need to specify the management URI of RabbitMQ");
+ URI managementUri = checkURI(managementUriAsString);
+
+ return new RabbitMQConfiguration(uri, managementUri);
}
private static URI checkURI(String uri) {
@@ -44,28 +50,36 @@ public class RabbitMQConfiguration {
throw new IllegalStateException("You need to specify a valid URI", e);
}
}
+
private final URI uri;
+ private final URI managementUri;
- private RabbitMQConfiguration(URI uri) {
+ private RabbitMQConfiguration(URI uri, URI managementUri) {
this.uri = uri;
+ this.managementUri = managementUri;
}
public URI getUri() {
return uri;
}
+ public URI getManagementUri() {
+ return managementUri;
+ }
+
@Override
public final boolean equals(Object o) {
if (o instanceof RabbitMQConfiguration) {
RabbitMQConfiguration that = (RabbitMQConfiguration) o;
- return Objects.equals(this.uri, that.uri);
+ return Objects.equals(this.uri, that.uri)
+ && Objects.equals(this.managementUri, that.managementUri);
}
return false;
}
@Override
public final int hashCode() {
- return Objects.hash(uri);
+ return Objects.hash(uri, managementUri);
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/269e3591/backends-common/rabbitmq/src/test/java/org/apache/james/backend/mailqueue/RabbitMQConfigurationTest.java
----------------------------------------------------------------------
diff --git a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/mailqueue/RabbitMQConfigurationTest.java b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/mailqueue/RabbitMQConfigurationTest.java
index b5b9d6e..10109cb 100644
--- a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/mailqueue/RabbitMQConfigurationTest.java
+++ b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/mailqueue/RabbitMQConfigurationTest.java
@@ -70,4 +70,56 @@ public class RabbitMQConfigurationTest {
.isInstanceOf(IllegalStateException.class)
.hasMessage("You need to specify a valid URI");
}
+
+ @Test
+ public void fromShouldThrowWhenManagementURIIsNotInTheConfiguration() {
+ PropertiesConfiguration configuration = new PropertiesConfiguration();
+ configuration.addProperty("uri", "amqp://james:james@rabbitmq_host:5672");
+
+ assertThatThrownBy(() -> RabbitMQConfiguration.from(configuration))
+ .isInstanceOf(IllegalStateException.class)
+ .hasMessage("You need to specify the management URI of RabbitMQ");
+ }
+
+ @Test
+ public void fromShouldThrowWhenManagementURIIsNull() {
+ PropertiesConfiguration configuration = new PropertiesConfiguration();
+ configuration.addProperty("uri", "amqp://james:james@rabbitmq_host:5672");
+ configuration.addProperty("management.uri", null);
+
+ assertThatThrownBy(() -> RabbitMQConfiguration.from(configuration))
+ .isInstanceOf(IllegalStateException.class)
+ .hasMessage("You need to specify the management URI of RabbitMQ");
+ }
+
+ @Test
+ public void fromShouldThrowWhenManagementURIIsEmpty() {
+ PropertiesConfiguration configuration = new PropertiesConfiguration();
+ configuration.addProperty("uri", "amqp://james:james@rabbitmq_host:5672");
+ configuration.addProperty("management.uri", "");
+
+ assertThatThrownBy(() -> RabbitMQConfiguration.from(configuration))
+ .isInstanceOf(IllegalStateException.class)
+ .hasMessage("You need to specify the management URI of RabbitMQ");
+ }
+
+ @Test
+ public void fromShouldThrowWhenManagementURIIsInvalid() {
+ PropertiesConfiguration configuration = new PropertiesConfiguration();
+ configuration.addProperty("uri", "amqp://james:james@rabbitmq_host:5672");
+ configuration.addProperty("management.uri", ":invalid");
+
+ assertThatThrownBy(() -> RabbitMQConfiguration.from(configuration))
+ .isInstanceOf(IllegalStateException.class)
+ .hasMessage("You need to specify a valid URI");
+ }
+
+ @Test
+ public void fromShouldNotThrowWhenRequiredParametersAreGiven() {
+ PropertiesConfiguration configuration = new PropertiesConfiguration();
+ configuration.addProperty("uri", "amqp://james:james@rabbitmq_host:5672");
+ configuration.addProperty("management.uri", "http://james:james@rabbitmq_host:15672/api/");
+
+ RabbitMQConfiguration.from(configuration);
+ }
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/269e3591/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
index 216956e..25d0dd6 100644
--- a/dockerfiles/run/guice/cassandra-ldap/destination/conf/rabbitmq.properties
+++ b/dockerfiles/run/guice/cassandra-ldap/destination/conf/rabbitmq.properties
@@ -1 +1,2 @@
-uri=amqp://james:james@rabbitmq_host:5672
\ No newline at end of file
+uri=amqp://james:james@rabbitmq_host:5672
+management.uri=http://james:james@rabbitmq_host:15672/api/
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/269e3591/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
index 216956e..25d0dd6 100644
--- a/dockerfiles/run/guice/cassandra/destination/conf/rabbitmq.properties
+++ b/dockerfiles/run/guice/cassandra/destination/conf/rabbitmq.properties
@@ -1 +1,2 @@
-uri=amqp://james:james@rabbitmq_host:5672
\ No newline at end of file
+uri=amqp://james:james@rabbitmq_host:5672
+management.uri=http://james:james@rabbitmq_host:15672/api/
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/269e3591/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
index 216956e..25d0dd6 100644
--- a/server/container/guice/cassandra-guice/src/test/resources/rabbitmq.properties
+++ b/server/container/guice/cassandra-guice/src/test/resources/rabbitmq.properties
@@ -1 +1,2 @@
-uri=amqp://james:james@rabbitmq_host:5672
\ No newline at end of file
+uri=amqp://james:james@rabbitmq_host:5672
+management.uri=http://james:james@rabbitmq_host:15672/api/
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[3/3] james-project git commit: JAMES-2537 Introduce a mail queue
configuration
Posted by ad...@apache.org.
JAMES-2537 Introduce a mail queue configuration
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/bb9c0a39
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/bb9c0a39
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/bb9c0a39
Branch: refs/heads/master
Commit: bb9c0a391dd29bf83b4b1454cf0de3239c8ff7ad
Parents: 9d08602
Author: Antoine Duprat <ad...@linagora.com>
Authored: Tue Sep 4 15:18:39 2018 +0200
Committer: Antoine Duprat <ad...@linagora.com>
Committed: Thu Sep 6 15:29:38 2018 +0200
----------------------------------------------------------------------
backends-common/pom.xml | 1 +
backends-common/rabbitmq/pom.xml | 69 ++++++++++++++++++
.../mailqueue/RabbitMQConfiguration.java | 71 +++++++++++++++++++
.../mailqueue/RabbitMQConfigurationTest.java | 73 ++++++++++++++++++++
core/pom.xml | 2 +-
pom.xml | 5 ++
6 files changed, 220 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/bb9c0a39/backends-common/pom.xml
----------------------------------------------------------------------
diff --git a/backends-common/pom.xml b/backends-common/pom.xml
index f5a4fc2..777397a 100644
--- a/backends-common/pom.xml
+++ b/backends-common/pom.xml
@@ -37,6 +37,7 @@
<module>cassandra</module>
<module>elasticsearch</module>
<module>jpa</module>
+ <module>rabbitmq</module>
</modules>
</project>
http://git-wip-us.apache.org/repos/asf/james-project/blob/bb9c0a39/backends-common/rabbitmq/pom.xml
----------------------------------------------------------------------
diff --git a/backends-common/rabbitmq/pom.xml b/backends-common/rabbitmq/pom.xml
new file mode 100644
index 0000000..ee842f2
--- /dev/null
+++ b/backends-common/rabbitmq/pom.xml
@@ -0,0 +1,69 @@
+<?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-backends-common</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>apache-james-backends-rabbitmq</artifactId>
+ <name>Apache James RabbitMQ backend</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-configuration</groupId>
+ <artifactId>commons-configuration</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>nl.jqno.equalsverifier</groupId>
+ <artifactId>equalsverifier</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-launcher</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/james-project/blob/bb9c0a39/backends-common/rabbitmq/src/main/java/org/apache/james/backend/mailqueue/RabbitMQConfiguration.java
----------------------------------------------------------------------
diff --git a/backends-common/rabbitmq/src/main/java/org/apache/james/backend/mailqueue/RabbitMQConfiguration.java b/backends-common/rabbitmq/src/main/java/org/apache/james/backend/mailqueue/RabbitMQConfiguration.java
new file mode 100644
index 0000000..98283e4
--- /dev/null
+++ b/backends-common/rabbitmq/src/main/java/org/apache/james/backend/mailqueue/RabbitMQConfiguration.java
@@ -0,0 +1,71 @@
+/****************************************************************
+ * 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.backend.mailqueue;
+
+import java.net.URI;
+import java.util.Objects;
+
+import org.apache.commons.configuration.PropertiesConfiguration;
+
+import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
+
+public class RabbitMQConfiguration {
+
+ private static final String URI_PROPERTY_NAME = "uri";
+
+ public static RabbitMQConfiguration from(PropertiesConfiguration configuration) {
+ String uriAsString = configuration.getString(URI_PROPERTY_NAME);
+ Preconditions.checkState(!Strings.isNullOrEmpty(uriAsString), "You need to specify the URI of RabbitMQ");
+ URI uri = checkURI(uriAsString);
+ return new RabbitMQConfiguration(uri);
+ }
+
+ private static URI checkURI(String uri) {
+ try {
+ return URI.create(uri);
+ } catch (Exception e) {
+ throw new IllegalStateException("You need to specify a valid URI", e);
+ }
+ }
+ private final URI uri;
+
+ private RabbitMQConfiguration(URI uri) {
+ this.uri = uri;
+ }
+
+ public URI getUri() {
+ return uri;
+ }
+
+ @Override
+ public final boolean equals(Object o) {
+ if (o instanceof RabbitMQConfiguration) {
+ RabbitMQConfiguration that = (RabbitMQConfiguration) o;
+
+ return Objects.equals(this.uri, that.uri);
+ }
+ return false;
+ }
+
+ @Override
+ public final int hashCode() {
+ return Objects.hash(uri);
+ }
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/bb9c0a39/backends-common/rabbitmq/src/test/java/org/apache/james/backend/mailqueue/RabbitMQConfigurationTest.java
----------------------------------------------------------------------
diff --git a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/mailqueue/RabbitMQConfigurationTest.java b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/mailqueue/RabbitMQConfigurationTest.java
new file mode 100644
index 0000000..b5b9d6e
--- /dev/null
+++ b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/mailqueue/RabbitMQConfigurationTest.java
@@ -0,0 +1,73 @@
+/****************************************************************
+ * 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.backend.mailqueue;
+
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.junit.jupiter.api.Test;
+
+import nl.jqno.equalsverifier.EqualsVerifier;
+
+public class RabbitMQConfigurationTest {
+
+ @Test
+ public void shouldRespectBeanContract() {
+ EqualsVerifier.forClass(RabbitMQConfiguration.class).verify();
+ }
+
+ @Test
+ public void fromShouldThrowWhenURIIsNotInTheConfiguration() {
+ PropertiesConfiguration configuration = new PropertiesConfiguration();
+
+ assertThatThrownBy(() -> RabbitMQConfiguration.from(configuration))
+ .isInstanceOf(IllegalStateException.class)
+ .hasMessage("You need to specify the URI of RabbitMQ");
+ }
+
+ @Test
+ public void fromShouldThrowWhenURIIsNull() {
+ PropertiesConfiguration configuration = new PropertiesConfiguration();
+ configuration.addProperty("uri", null);
+
+ assertThatThrownBy(() -> RabbitMQConfiguration.from(configuration))
+ .isInstanceOf(IllegalStateException.class)
+ .hasMessage("You need to specify the URI of RabbitMQ");
+ }
+
+ @Test
+ public void fromShouldThrowWhenURIIsEmpty() {
+ PropertiesConfiguration configuration = new PropertiesConfiguration();
+ configuration.addProperty("uri", "");
+
+ assertThatThrownBy(() -> RabbitMQConfiguration.from(configuration))
+ .isInstanceOf(IllegalStateException.class)
+ .hasMessage("You need to specify the URI of RabbitMQ");
+ }
+
+ @Test
+ public void fromShouldThrowWhenURIIsInvalid() {
+ PropertiesConfiguration configuration = new PropertiesConfiguration();
+ configuration.addProperty("uri", ":invalid");
+
+ assertThatThrownBy(() -> RabbitMQConfiguration.from(configuration))
+ .isInstanceOf(IllegalStateException.class)
+ .hasMessage("You need to specify a valid URI");
+ }
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/bb9c0a39/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index ffda134..6c2ec01 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -88,4 +88,4 @@
</dependency>
</dependencies>
-</project>
\ No newline at end of file
+</project>
http://git-wip-us.apache.org/repos/asf/james-project/blob/bb9c0a39/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 508db16..d90eb59 100644
--- a/pom.xml
+++ b/pom.xml
@@ -701,6 +701,11 @@
</dependency>
<dependency>
<groupId>${james.groupId}</groupId>
+ <artifactId>apache-james-backends-rabbitmq</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${james.groupId}</groupId>
<artifactId>apache-james-spamassassin</artifactId>
<version>${project.version}</version>
</dependency>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[2/3] james-project git commit: JAMES-2537 Load RabbitMQ
configuration in Cassandra Guice base products
Posted by ad...@apache.org.
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 <ad...@linagora.com>
Authored: Tue Sep 4 16:18:24 2018 +0200
Committer: Antoine Duprat <ad...@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