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 ro...@apache.org on 2018/02/27 08:27:13 UTC
[1/2] james-project git commit: MAILET-161 Don't fail on
AlreadyClosedException when contacting an AMQP exchange
Repository: james-project
Updated Branches:
refs/heads/master 500510f11 -> dbe65ce08
MAILET-161 Don't fail on AlreadyClosedException when contacting an AMQP exchange
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/eae7d4a5
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/eae7d4a5
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/eae7d4a5
Branch: refs/heads/master
Commit: eae7d4a52b9f1a2e23640b87362948b03ca35cac
Parents: 21bd4ff
Author: Raphael Ouazana <ra...@linagora.com>
Authored: Mon Feb 26 16:41:10 2018 +0100
Committer: Raphael Ouazana <ra...@linagora.com>
Committed: Mon Feb 26 16:41:10 2018 +0100
----------------------------------------------------------------------
.../transport/mailets/AmqpForwardAttribute.java | 3 +++
.../transport/mailets/AmqpForwardAttributeTest.java | 16 ++++++++++++++++
2 files changed, 19 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/eae7d4a5/mailet/standard/src/main/java/org/apache/james/transport/mailets/AmqpForwardAttribute.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/main/java/org/apache/james/transport/mailets/AmqpForwardAttribute.java b/mailet/standard/src/main/java/org/apache/james/transport/mailets/AmqpForwardAttribute.java
index 04be8ba..750adc6 100644
--- a/mailet/standard/src/main/java/org/apache/james/transport/mailets/AmqpForwardAttribute.java
+++ b/mailet/standard/src/main/java/org/apache/james/transport/mailets/AmqpForwardAttribute.java
@@ -37,6 +37,7 @@ import com.github.fge.lambdas.Throwing;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Strings;
import com.rabbitmq.client.AMQP;
+import com.rabbitmq.client.AlreadyClosedException;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
@@ -115,6 +116,8 @@ public class AmqpForwardAttribute extends GenericMailet {
LOGGER.error("IOException while writing to AMQP: {}", e.getMessage(), e);
} catch (TimeoutException e) {
LOGGER.error("TimeoutException while writing to AMQP: {}", e.getMessage(), e);
+ } catch (AlreadyClosedException e) {
+ LOGGER.error("AlreadyClosedException while writing to AMQP: {}", e.getMessage(), e);
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/eae7d4a5/mailet/standard/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttributeTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttributeTest.java b/mailet/standard/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttributeTest.java
index 4859ffa..29f873b 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttributeTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttributeTest.java
@@ -48,9 +48,12 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.AMQP.BasicProperties;
+import com.rabbitmq.client.AMQP.Channel.Close;
+import com.rabbitmq.client.AlreadyClosedException;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
+import com.rabbitmq.client.ShutdownSignalException;
public class AmqpForwardAttributeTest {
@@ -207,6 +210,19 @@ public class AmqpForwardAttributeTest {
}
@Test
+ public void serviceShouldNotFailWhenAlreadyClosedException() throws Exception {
+ mailet.init(mailetConfig);
+ Mail mail = mock(Mail.class);
+ when(mail.getAttribute(MAIL_ATTRIBUTE)).thenReturn(ATTRIBUTE_CONTENT);
+ ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
+ ShutdownSignalException shutdownSignalException = new ShutdownSignalException(false, false, new Close.Builder().build(), "reference");
+ when(connectionFactory.newConnection()).thenThrow(new AlreadyClosedException(shutdownSignalException));
+ mailet.setConnectionFactory(connectionFactory);
+
+ mailet.service(mail);
+ }
+
+ @Test
public void serviceShouldPublishAttributeContentWhenAttributeInMailAndIsAMap() throws Exception {
mailet.init(mailetConfig);
Channel channel = mock(Channel.class);
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
[2/2] james-project git commit: Merge remote-tracking branch
'mine/MAILET-161'
Posted by ro...@apache.org.
Merge remote-tracking branch 'mine/MAILET-161'
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/dbe65ce0
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/dbe65ce0
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/dbe65ce0
Branch: refs/heads/master
Commit: dbe65ce0862c72ff8e3d92ccbd02a0a295ea9a64
Parents: 500510f eae7d4a
Author: Raphael Ouazana <ra...@linagora.com>
Authored: Tue Feb 27 09:26:35 2018 +0100
Committer: Raphael Ouazana <ra...@linagora.com>
Committed: Tue Feb 27 09:26:35 2018 +0100
----------------------------------------------------------------------
.../transport/mailets/AmqpForwardAttribute.java | 3 +++
.../transport/mailets/AmqpForwardAttributeTest.java | 16 ++++++++++++++++
2 files changed, 19 insertions(+)
----------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org