diff --git a/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.1.xsd b/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.1.xsd index 54ef845714..4ce2f51032 100644 --- a/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.1.xsd +++ b/spring-integration-core/src/main/resources/org/springframework/integration/config/xml/spring-integration-2.1.xsd @@ -1603,17 +1603,21 @@ endpoint itself is a Polling Consumer for a channel with a queue. - + - Shortcut to specify value for 'replyChannel' header + Shortcut to specify value for 'replyChannel' header. + Can be a 'ref' to the MessageChannel, a 'value' as name of the MessageChannel, + or some valid SpEL 'expression' which returns the MessageChannel reference or name of the MessageChannel. - + - Shortcut to specify value for 'errorChannel' header + Shortcut to specify value for 'errorChannel' header. + Can be a 'ref' to the MessageChannel, a 'value' as name of the MessageChannel, + or some valid SpEL 'expression' which returns the MessageChannel reference or name of the MessageChannel. @@ -1795,7 +1799,7 @@ endpoint itself is a Polling Consumer for a channel with a queue. - Expression to be evaulated at runtime to determine the header value. + Expression to be evaluated at runtime to determine the header value. The EvaluationContext will include variables for 'payload' and 'headers'. diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherTests-context.xml index a828b06e8a..ee182870ca 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherTests-context.xml +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherTests-context.xml @@ -11,6 +11,14 @@ + + + + + + + + diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherTests.java index 3ae50ff6b3..42bafd2a15 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/HeaderEnricherTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2011 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. @@ -60,6 +60,28 @@ public class HeaderEnricherTests { assertEquals(replyChannel, result.getHeaders().getReplyChannel()); } + @Test //INT-2316 + public void replyChannelName() { + PollableChannel replyChannel = context.getBean("testReplyChannel", PollableChannel.class); + MessageChannel inputChannel = context.getBean("replyChannelNameInput", MessageChannel.class); + inputChannel.send(new GenericMessage("test")); + Message result = replyChannel.receive(0); + assertNotNull(result); + assertEquals("TEST", result.getPayload()); + assertEquals("testReplyChannel", result.getHeaders().getReplyChannel()); + } + + @Test //INT-2316 + public void replyChannelExpression() { + PollableChannel replyChannel = context.getBean("testReplyChannel", PollableChannel.class); + MessageChannel inputChannel = context.getBean("replyChannelExpressionInput", MessageChannel.class); + inputChannel.send(new GenericMessage("test")); + Message result = replyChannel.receive(0); + assertNotNull(result); + assertEquals("TEST", result.getPayload()); + assertEquals(replyChannel, result.getHeaders().getReplyChannel()); + } + @Test public void errorChannel() { PollableChannel errorChannel = context.getBean("testErrorChannel", PollableChannel.class);