AMQP-508: Queue Declaration IllegalArgumentExcept

JIRA: https://jira.spring.io/browse/AMQP-508

Fix cherry-pick conflicts: https://build.spring.io/browse/AMQP-B12X-44
This commit is contained in:
Artem Bilan
2015-06-29 12:40:44 -04:00
parent 344fcb9f03
commit be36ffd120
2 changed files with 11 additions and 22 deletions

View File

@@ -17,7 +17,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Properties;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.commons.logging.Log;
@@ -265,12 +264,8 @@ public class RabbitAdmin implements AmqpAdmin, ApplicationContextAware, Initiali
return props;
}
catch (IllegalArgumentException e) {
try {
if (channel instanceof ChannelProxy) {
((ChannelProxy) channel).getTargetChannel().close();
}
}
catch (TimeoutException e1) {
if (channel instanceof ChannelProxy) {
((ChannelProxy) channel).getTargetChannel().close();
}
return null;
}
@@ -458,17 +453,13 @@ public class RabbitAdmin implements AmqpAdmin, ApplicationContextAware, Initiali
}
try {
try {
DeclareOk declareOk = channel.queueDeclare(queue.getName(), queue.isDurable(), queue.isExclusive(), queue.isAutoDelete(),
queue.getArguments());
DeclareOk declareOk = channel.queueDeclare(queue.getName(), queue.isDurable(),
queue.isExclusive(), queue.isAutoDelete(), queue.getArguments());
declareOks[i] = declareOk;
}
catch (IllegalArgumentException e) {
try {
if (channel instanceof ChannelProxy) {
((ChannelProxy) channel).getTargetChannel().close();
}
}
catch (TimeoutException e1) {
if (channel instanceof ChannelProxy) {
((ChannelProxy) channel).getTargetChannel().close();
}
throw new IOException(e);
}
@@ -549,7 +540,8 @@ public class RabbitAdmin implements AmqpAdmin, ApplicationContextAware, Initiali
private boolean isDeclaringImplicitQueueBinding(Binding binding) {
if (isImplicitQueueBinding(binding)) {
if (logger.isDebugEnabled()) {
logger.debug("The default exchange is implicitly bound to every queue, with a routing key equal to the queue name.");
logger.debug("The default exchange is implicitly bound to every queue, " +
"with a routing key equal to the queue name.");
}
return true;
}
@@ -569,4 +561,5 @@ public class RabbitAdmin implements AmqpAdmin, ApplicationContextAware, Initiali
private boolean isImplicitQueueBinding(Binding binding) {
return isDefaultExchange(binding.getExchange()) && binding.getDestination().equals(binding.getRoutingKey());
}
}

View File

@@ -529,12 +529,8 @@ public class BlockingQueueConsumer {
this.channel.queueDeclarePassive(queueName);
}
catch (IllegalArgumentException e) {
try {
if (this.channel instanceof ChannelProxy) {
((ChannelProxy) this.channel).getTargetChannel().close();
}
}
catch (TimeoutException e1) {
if (this.channel instanceof ChannelProxy) {
((ChannelProxy) this.channel).getTargetChannel().close();
}
throw new FatalListenerStartupException("Illegal Argument on Queue Declaration", e);
}