forked from spring-projects/spring-integration
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add RedisQueueOutboundGateway and RedisQueueInboundGateway JIRA: https://jira.spring.io/browse/INT-3341 add test fix format issue change expectmessage to extractpayload, fix test potential bug fix copyright year fix format and naming issue fix as Artem's comments fix as Artem's comments change boolean condition judgement INT-3341: Polishing Minor Doc Polishing
- Loading branch information
1 parent
ff2b15e
commit 1d4785f
Showing
17 changed files
with
1,443 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...ain/java/org/springframework/integration/redis/config/RedisQueueInboundGatewayParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* 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.integration.config.xml.AbstractInboundGatewayParser; | ||
import org.springframework.integration.config.xml.IntegrationNamespaceUtils; | ||
import org.springframework.integration.redis.inbound.RedisQueueInboundGateway; | ||
import org.springframework.util.StringUtils; | ||
|
||
/** | ||
* Parser for the <queue-inbound-gateway> element of the 'redis' namespace. | ||
* | ||
* @author David Liu | ||
* @author Artem Bilan | ||
* @since 4.1 | ||
*/ | ||
public class RedisQueueInboundGatewayParser extends AbstractInboundGatewayParser { | ||
|
||
@Override | ||
protected Class<?> getBeanClass(Element element) { | ||
return RedisQueueInboundGateway.class; | ||
} | ||
|
||
@Override | ||
protected boolean isEligibleAttribute(String attributeName) { | ||
return !attributeName.equals("queue") | ||
&& !attributeName.equals("connection-factory") | ||
&& !attributeName.equals("serializer") | ||
&& !attributeName.equals("task-executor") | ||
&& super.isEligibleAttribute(attributeName); | ||
} | ||
|
||
@Override | ||
protected void doPostProcess(BeanDefinitionBuilder builder, Element element) { | ||
builder.addConstructorArgValue(element.getAttribute("queue")); | ||
String connectionFactory = element.getAttribute("connection-factory"); | ||
if (!StringUtils.hasText(connectionFactory)) { | ||
connectionFactory = "redisConnectionFactory"; | ||
} | ||
builder.addConstructorArgReference(connectionFactory); | ||
|
||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "serializer", true); | ||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "task-executor"); | ||
} | ||
|
||
} |
59 changes: 59 additions & 0 deletions
59
...in/java/org/springframework/integration/redis/config/RedisQueueOutboundGatewayParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* 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.RedisQueueOutboundGateway; | ||
import org.springframework.util.StringUtils; | ||
|
||
/** | ||
* Parser for the <int-redis:queue-outbound-channel-adapter> element. | ||
* | ||
* @author Artem Bilan | ||
* @author David Liu | ||
* @since 3.0 | ||
*/ | ||
public class RedisQueueOutboundGatewayParser extends AbstractConsumerEndpointParser { | ||
|
||
@Override | ||
protected String getInputChannelAttributeName() { | ||
return "request-channel"; | ||
} | ||
|
||
@Override | ||
protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) { | ||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(RedisQueueOutboundGateway.class); | ||
builder.addConstructorArgValue(element.getAttribute("queue")); | ||
String connectionFactory = element.getAttribute("connection-factory"); | ||
if (!StringUtils.hasText(connectionFactory)) { | ||
connectionFactory = "redisConnectionFactory"; | ||
} | ||
builder.addConstructorArgReference(connectionFactory); | ||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "reply-channel", "outputChannel"); | ||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "extract-payload"); | ||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "serializer"); | ||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "reply-timeout", "receiveTimeout"); | ||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "requires-reply"); | ||
return builder; | ||
} | ||
|
||
} |
Oops, something went wrong.