diff --git a/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/config/QueueParserTests.java b/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/config/QueueParserTests.java index a54433f2..62f52414 100644 --- a/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/config/QueueParserTests.java +++ b/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/config/QueueParserTests.java @@ -1,11 +1,11 @@ /* - * Copyright 2002-2008 the original author or authors. - * + * Copyright 2002-2012 the original author or authors. + * * Licensed 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. @@ -91,6 +91,8 @@ public class QueueParserTests { Queue queue = beanFactory.getBean("arguments", Queue.class); assertNotNull(queue); assertEquals("bar", queue.getArguments().get("foo")); + assertEquals(100L, queue.getArguments().get("x-message-ttl")); + assertEquals("all", queue.getArguments().get("x-ha-policy")); } @Test diff --git a/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/QueueParserPlaceholderTests-context.xml b/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/QueueParserPlaceholderTests-context.xml index 10372047..8b60b0d3 100644 --- a/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/QueueParserPlaceholderTests-context.xml +++ b/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/QueueParserPlaceholderTests-context.xml @@ -10,6 +10,8 @@ foo true bar + 100 + all @@ -27,6 +29,10 @@ + + ${ttl} + + diff --git a/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/QueueParserTests-context.xml b/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/QueueParserTests-context.xml index 87654b48..121d4b3e 100644 --- a/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/QueueParserTests-context.xml +++ b/spring-rabbit/src/test/resources/org/springframework/amqp/rabbit/config/QueueParserTests-context.xml @@ -17,6 +17,10 @@ + + 100 + + diff --git a/src/docbkx/amqp.xml b/src/docbkx/amqp.xml index e2544f9b..c2898280 100644 --- a/src/docbkx/amqp.xml +++ b/src/docbkx/amqp.xml @@ -157,6 +157,10 @@ or other temporary situations. For that reason, the 'exclusive' and 'autoDelete' properties of an auto-generated Queue would both be set to 'true'. + + See the section on queues in + for information about declaring queues using namespace support, including + queue arguments. @@ -800,6 +804,50 @@ Object receiveAndConvert(String queueName) throws AmqpException;]]>]]> + Queues can be configured with additional arguments, for example, + 'x-message-ttl' or 'x-ha-policy'. Using the namespace support, they are provided in the form of + a Map of argument name/argument value pairs, using the + <rabbit:queue-arguments> element. + + + + + + +]]> + + By default, the arguments are assumed to be strings. For arguments + of other types, the type needs to be provided. + + + + + + +]]> + + When providing arguments of mixed types, the type is provided for each entry element: + + + + + 100 + + + + +]]> + + With Spring Framework 3.2 and later, this can be declared a little more succinctly: + + + + + + + +]]> + To see how to use Java to configure the AMQP infrastructure, look at the Stock sample application, where there is the @Configuration class AbstractStockRabbitConfiguration which in