diff --git a/build.gradle b/build.gradle
index 9467075d20..848e49f626 100644
--- a/build.gradle
+++ b/build.gradle
@@ -99,7 +99,7 @@ subprojects { subproject ->
smackVersion = '3.2.1'
springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '1.3.0.RELEASE'
springDataMongoVersion = '1.1.1.RELEASE'
- springDataRedisVersion = '1.1.1.RELEASE'
+ springDataRedisVersion = '1.2.1.RELEASE'
springGemfireVersion = '1.3.1.RELEASE'
springSecurityVersion = '3.1.3.RELEASE'
springSocialTwitterVersion = '1.1.0.M4'
diff --git a/spring-integration-redis/src/main/java/org/springframework/integration/redis/config/RedisNamespaceHandler.java b/spring-integration-redis/src/main/java/org/springframework/integration/redis/config/RedisNamespaceHandler.java
index c13c32bc06..12b614c4b6 100644
--- a/spring-integration-redis/src/main/java/org/springframework/integration/redis/config/RedisNamespaceHandler.java
+++ b/spring-integration-redis/src/main/java/org/springframework/integration/redis/config/RedisNamespaceHandler.java
@@ -34,5 +34,6 @@ public class RedisNamespaceHandler extends AbstractIntegrationNamespaceHandler {
registerBeanDefinitionParser("outbound-channel-adapter", new RedisOutboundChannelAdapterParser());
registerBeanDefinitionParser("queue-inbound-channel-adapter", new RedisQueueInboundChannelAdapterParser());
registerBeanDefinitionParser("queue-outbound-channel-adapter", new RedisQueueOutboundChannelAdapterParser());
+ registerBeanDefinitionParser("outbound-gateway", new RedisOutboundGatewayParser());
}
}
diff --git a/spring-integration-redis/src/main/java/org/springframework/integration/redis/config/RedisOutboundGatewayParser.java b/spring-integration-redis/src/main/java/org/springframework/integration/redis/config/RedisOutboundGatewayParser.java
new file mode 100644
index 0000000000..be34839e8c
--- /dev/null
+++ b/spring-integration-redis/src/main/java/org/springframework/integration/redis/config/RedisOutboundGatewayParser.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2014 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.
+ */
+
+package org.springframework.integration.redis.config;
+
+import org.w3c.dom.Element;
+
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.springframework.integration.config.xml.AbstractConsumerEndpointParser;
+import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
+import org.springframework.integration.redis.outbound.ExpressionArgumentsStrategy;
+import org.springframework.integration.redis.outbound.RedisOutboundGateway;
+import org.springframework.util.StringUtils;
+
+/**
+ * Parser for the {@code } component.
+ *
+ * @author Artem Bilan
+ * @since 4.0
+ */
+public class RedisOutboundGatewayParser extends AbstractConsumerEndpointParser {
+
+ @Override
+ protected String getInputChannelAttributeName() {
+ return "request-channel";
+ }
+
+ @Override
+ protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) {
+ BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(RedisOutboundGateway.class);
+
+ String redisTemplate = element.getAttribute("redis-template");
+ String connectionFactory = element.getAttribute("connection-factory");
+ if (StringUtils.hasText(redisTemplate) && StringUtils.hasText(connectionFactory)) {
+ parserContext.getReaderContext().error("Only one of '" + redisTemplate + "' or '"
+ + connectionFactory + "' is allowed.", element);
+ }
+ if (StringUtils.hasText(redisTemplate)) {
+ builder.addConstructorArgReference(redisTemplate);
+ }
+ else {
+ if (!StringUtils.hasText(connectionFactory)) {
+ connectionFactory = "redisConnectionFactory";
+ }
+ builder.addConstructorArgReference(connectionFactory);
+ }
+
+ String argumentExpressions = element.getAttribute("argument-expressions");
+ boolean hasArgumentExpressions = StringUtils.hasText(argumentExpressions);
+ String argumentsStrategy = element.getAttribute("arguments-strategy");
+ boolean hasArgumentStrategy = element.hasAttribute("arguments-strategy");
+
+ if (hasArgumentExpressions & hasArgumentStrategy) {
+ parserContext.getReaderContext()
+ .error("'argument-expressions' and 'arguments-strategy' are mutually exclusive.", element);
+ }
+
+ if (hasArgumentExpressions) {
+ BeanDefinitionBuilder argumentsBuilder = BeanDefinitionBuilder.genericBeanDefinition(ExpressionArgumentsStrategy.class)
+ .addConstructorArgValue(argumentExpressions)
+ .addConstructorArgValue(element.getAttribute("use-command-variable"));
+ builder.addPropertyValue("argumentsStrategy", argumentsBuilder.getBeanDefinition());
+ }
+ else if (StringUtils.hasLength(argumentsStrategy)) {
+ builder.addPropertyReference("argumentsStrategy", argumentsStrategy);
+ }
+ else if (hasArgumentStrategy) {
+ builder.addPropertyValue("argumentsStrategy", null);
+ }
+
+ IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "reply-channel", "outputChannel");
+ IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "requires-reply");
+ IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "reply-timeout", "sendTimeout");
+ IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "command-expression");
+ IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "arguments-serializer");
+
+ return builder;
+ }
+}
diff --git a/spring-integration-redis/src/main/java/org/springframework/integration/redis/outbound/ArgumentsStrategy.java b/spring-integration-redis/src/main/java/org/springframework/integration/redis/outbound/ArgumentsStrategy.java
new file mode 100644
index 0000000000..f91e097282
--- /dev/null
+++ b/spring-integration-redis/src/main/java/org/springframework/integration/redis/outbound/ArgumentsStrategy.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2014 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.
+ */
+
+package org.springframework.integration.redis.outbound;
+
+import org.springframework.messaging.Message;
+
+/**
+ * @author Artem Bilan
+ * @since 4.0
+ */
+public interface ArgumentsStrategy {
+
+ Object[] resolve(String command, Message> message);
+
+}
diff --git a/spring-integration-redis/src/main/java/org/springframework/integration/redis/outbound/ExpressionArgumentsStrategy.java b/spring-integration-redis/src/main/java/org/springframework/integration/redis/outbound/ExpressionArgumentsStrategy.java
new file mode 100644
index 0000000000..e8ffb1e308
--- /dev/null
+++ b/spring-integration-redis/src/main/java/org/springframework/integration/redis/outbound/ExpressionArgumentsStrategy.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2014 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.
+ */
+
+package org.springframework.integration.redis.outbound;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.BeanFactoryAware;
+import org.springframework.expression.EvaluationContext;
+import org.springframework.expression.Expression;
+import org.springframework.expression.spel.standard.SpelExpressionParser;
+import org.springframework.integration.context.IntegrationContextUtils;
+import org.springframework.integration.expression.IntegrationEvaluationContextAware;
+import org.springframework.messaging.Message;
+import org.springframework.util.Assert;
+
+/**
+ * @author Artem Bilan
+ * @since 4.0
+ */
+public class ExpressionArgumentsStrategy implements ArgumentsStrategy, IntegrationEvaluationContextAware, BeanFactoryAware {
+
+ private static final SpelExpressionParser PARSER = new SpelExpressionParser();
+
+ private final Expression[] argumentExpressions;
+
+ private EvaluationContext evaluationContext;
+
+ private final boolean useCommandVariable;
+
+ private BeanFactory beanFactory;
+
+ public ExpressionArgumentsStrategy(String[] argumentExpressions) {
+ this(argumentExpressions, false);
+ }
+
+ public ExpressionArgumentsStrategy(String[] argumentExpressions, boolean useCommandVariable) {
+ Assert.notNull(argumentExpressions, "'argumentExpressions' must not be null");
+ Assert.noNullElements(argumentExpressions, "'argumentExpressions' cannot have null values.");
+ List expressions = new LinkedList();
+ for (String argumentExpression : argumentExpressions) {
+ expressions.add(PARSER.parseExpression(argumentExpression));
+ }
+ this.argumentExpressions = expressions.toArray(new Expression[expressions.size()]);
+ this.useCommandVariable = useCommandVariable;
+ }
+
+ @Override
+ public void setIntegrationEvaluationContext(EvaluationContext evaluationContext) {
+ Assert.notNull(evaluationContext, "'evaluationContext' must not be null");
+ this.evaluationContext = evaluationContext;
+ }
+
+ @Override
+ public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
+ this.beanFactory = beanFactory;
+ }
+
+ @Override
+ public Object[] resolve(String command, Message> message) {
+ EvaluationContext evaluationContext = this.evaluationContext;
+
+ if (this.useCommandVariable) {
+ evaluationContext = IntegrationContextUtils.getEvaluationContext(this.beanFactory);
+ evaluationContext.setVariable("cmd", command);
+ }
+
+ List