INT-804 JMS header-enricher now properly expects a JMS Destination reference rather than a String in the 'reply-to' attribute.
This commit is contained in:
@@ -34,7 +34,7 @@ public class JmsNamespaceHandler extends AbstractIntegrationNamespaceHandler {
|
||||
this.registerBeanDefinitionParser("outbound-gateway", new JmsOutboundGatewayParser());
|
||||
this.registerBeanDefinitionParser("outbound-channel-adapter", new JmsOutboundChannelAdapterParser());
|
||||
this.registerBeanDefinitionParser("header-enricher",
|
||||
new SimpleHeaderEnricherParser(JmsHeaders.PREFIX, new String[] { "reply-to" }));
|
||||
new SimpleHeaderEnricherParser(JmsHeaders.PREFIX, new String[] { "replyTo" }));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:integration="http://www.springframework.org/schema/integration"
|
||||
xmlns:jms="http://www.springframework.org/schema/integration/jms"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/jms
|
||||
http://www.springframework.org/schema/integration/jms/spring-integration-jms.xsd">
|
||||
|
||||
<jms:header-enricher input-channel="input" output-channel="output"
|
||||
reply-to="testDestination"/>
|
||||
|
||||
<bean id="testDestination" class="org.springframework.integration.jms.StubDestination"/>
|
||||
|
||||
<integration:channel id="output">
|
||||
<integration:queue capacity="1"/>
|
||||
</integration:channel>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright 2002-2009 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.jms.config;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import javax.jms.Destination;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.integration.channel.PollableChannel;
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.core.MessageChannel;
|
||||
import org.springframework.integration.jms.HeaderMappingMessageConverter;
|
||||
import org.springframework.integration.jms.JmsHeaders;
|
||||
import org.springframework.integration.jms.StubSession;
|
||||
import org.springframework.integration.message.StringMessage;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class JmsHeaderEnricherTests {
|
||||
|
||||
@Autowired
|
||||
private MessageChannel input;
|
||||
|
||||
@Autowired
|
||||
private PollableChannel output;
|
||||
|
||||
@Autowired
|
||||
private Destination testDestination;
|
||||
|
||||
@Test // INT-804
|
||||
public void verifyReplyTo() throws Exception {
|
||||
input.send(new StringMessage("test"));
|
||||
Message<?> result = output.receive(0);
|
||||
assertEquals(testDestination, result.getHeaders().get(JmsHeaders.REPLY_TO));
|
||||
HeaderMappingMessageConverter converter = new HeaderMappingMessageConverter();
|
||||
javax.jms.Message jmsMessage = converter.toMessage(result, new StubSession("foo"));
|
||||
assertEquals(testDestination, jmsMessage.getJMSReplyTo());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user