This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 3c25367e6b99b9ba32f9e8e61da9a7dfd6b273dd Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Tue Jan 12 15:08:58 2021 +0100 CAMEL-16003: camel-spring-rabbitmq - New component using spring client --- .../component/springrabbit/RabbitMQComponent.java | 4 ++++ .../component/springrabbit/RabbitMQEndpoint.java | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/RabbitMQComponent.java b/components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/RabbitMQComponent.java index ff4975f..581d1b9c 100644 --- a/components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/RabbitMQComponent.java +++ b/components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/RabbitMQComponent.java @@ -23,11 +23,13 @@ import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriParam; import org.apache.camel.spi.annotations.Component; import org.apache.camel.support.HeaderFilterStrategyComponent; +import org.apache.camel.util.PropertiesHelper; import org.springframework.amqp.core.AmqpAdmin; import org.springframework.amqp.rabbit.connection.ConnectionFactory; import org.springframework.amqp.support.converter.MessageConverter; import org.springframework.util.ErrorHandler; +import static org.apache.camel.component.springrabbit.RabbitMQEndpoint.ARG_PREFIX; import static org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.DEFAULT_PREFETCH_COUNT; import static org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.DEFAULT_SHUTDOWN_TIMEOUT; @@ -115,7 +117,9 @@ public class RabbitMQComponent extends HeaderFilterStrategyComponent { endpoint.setDeadLetterRoutingKey(deadLetterRoutingKey); endpoint.setReplyTimeout(replyTimeout); + endpoint.setArgs(PropertiesHelper.extractProperties(parameters, ARG_PREFIX)); setProperties(endpoint, parameters); + return endpoint; } diff --git a/components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/RabbitMQEndpoint.java b/components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/RabbitMQEndpoint.java index cb1b3ac..9346716 100644 --- a/components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/RabbitMQEndpoint.java +++ b/components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/RabbitMQEndpoint.java @@ -464,9 +464,9 @@ public class RabbitMQEndpoint extends DefaultEndpoint implements AsyncEndpoint { } } - Map<String, Object> args = getExchangeArgs(); - boolean durable = parseArgsBoolean(args, "durable", "true"); - boolean autoDelete = parseArgsBoolean(args, "autoDelete", "false"); + Map<String, Object> map = getExchangeArgs(); + boolean durable = parseArgsBoolean(map, "durable", "true"); + boolean autoDelete = parseArgsBoolean(map, "autoDelete", "false"); if (!durable || autoDelete) { LOG.info("Auto-declaring a non-durable or auto-delete Exchange (" + exchangeName @@ -481,7 +481,7 @@ public class RabbitMQEndpoint extends DefaultEndpoint implements AsyncEndpoint { if (autoDelete) { eb.autoDelete(); } - eb.withArguments(args); + eb.withArguments(map); final org.springframework.amqp.core.Exchange rabbitExchange = eb.build(); admin.declareExchange(rabbitExchange); @@ -497,11 +497,11 @@ public class RabbitMQEndpoint extends DefaultEndpoint implements AsyncEndpoint { for (String queue : queuesToDeclare.split(",")) { queue = queue.trim(); - args = getQueueArgs(); - prepareDeadLetterQueueArgs(args); - durable = parseArgsBoolean(args, "durable", "false"); - autoDelete = parseArgsBoolean(args, "autoDelete", autoDeleteDefault); - boolean exclusive = parseArgsBoolean(args, "exclusive", "false"); + map = getQueueArgs(); + prepareDeadLetterQueueArgs(map); + durable = parseArgsBoolean(map, "durable", "false"); + autoDelete = parseArgsBoolean(map, "autoDelete", autoDeleteDefault); + boolean exclusive = parseArgsBoolean(map, "exclusive", "false"); QueueBuilder qb; if (queue.isEmpty()) { @@ -515,7 +515,7 @@ public class RabbitMQEndpoint extends DefaultEndpoint implements AsyncEndpoint { if (exclusive) { qb.exclusive(); } - qb.withArguments(args); + qb.withArguments(map); final Queue rabbitQueue = qb.build(); if (!durable || autoDelete || exclusive) {