All pre-defined internal header names are now valid Java identifiers. Dot delimiters have been replaced by underscores, and hyphenated names are now camelCase. The SimpleHeaderEnricherParser uses Conventions.attributeToPropertyName(). The attributes are now legal for passing as JMS properties (INT-511).
This commit is contained in:
@@ -28,6 +28,7 @@ import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.ManagedMap;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.core.Conventions;
|
||||
import org.springframework.integration.transformer.HeaderEnricher;
|
||||
import org.springframework.integration.transformer.Transformer;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
@@ -84,6 +85,7 @@ public class SimpleHeaderEnricherParser extends AbstractTransformerParser {
|
||||
Node node = attributes.item(i);
|
||||
String name = node.getNodeName();
|
||||
if (this.isEligibleHeaderName(name)) {
|
||||
name = Conventions.attributeNameToPropertyName(name);
|
||||
Object value = (this.referenceAttributes.contains(name))
|
||||
? new RuntimeBeanReference(node.getNodeValue())
|
||||
: node.getNodeValue();
|
||||
|
||||
@@ -42,25 +42,25 @@ public final class MessageHeaders implements Map<String, Object>, Serializable {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(MessageHeaders.class);
|
||||
|
||||
public static final String PREFIX = "spring.integration.";
|
||||
public static final String PREFIX = "springintegration_";
|
||||
|
||||
public static final String ID = PREFIX + "id";
|
||||
|
||||
public static final String TIMESTAMP = PREFIX + "timestamp";
|
||||
|
||||
public static final String CORRELATION_ID = PREFIX + "correlation-id";
|
||||
public static final String CORRELATION_ID = PREFIX + "correlationId";
|
||||
|
||||
public static final String REPLY_CHANNEL = PREFIX + "reply-channel";
|
||||
public static final String REPLY_CHANNEL = PREFIX + "replyChannel";
|
||||
|
||||
public static final String ERROR_CHANNEL = PREFIX + "error-channel";
|
||||
public static final String ERROR_CHANNEL = PREFIX + "errorChannel";
|
||||
|
||||
public static final String EXPIRATION_DATE = PREFIX + "expiration-date";
|
||||
public static final String EXPIRATION_DATE = PREFIX + "expirationDate";
|
||||
|
||||
public static final String PRIORITY = PREFIX + "priority";
|
||||
|
||||
public static final String SEQUENCE_NUMBER = PREFIX + "sequence-number";
|
||||
public static final String SEQUENCE_NUMBER = PREFIX + "sequenceNumber";
|
||||
|
||||
public static final String SEQUENCE_SIZE = PREFIX + "sequence-size";
|
||||
public static final String SEQUENCE_SIZE = PREFIX + "sequenceSize";
|
||||
|
||||
|
||||
private final Map<String, Object> headers;
|
||||
|
||||
@@ -48,7 +48,7 @@ public class ChannelInterceptorTests {
|
||||
Message<?> result = channel.receive(0);
|
||||
assertNotNull(result);
|
||||
assertEquals("test", result.getPayload());
|
||||
assertEquals(1, result.getHeaders().get(PreSendReturnsMessageInterceptor.class.getName()));
|
||||
assertEquals(1, result.getHeaders().get(PreSendReturnsMessageInterceptor.class.getSimpleName()));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -161,7 +161,7 @@ public class ChannelInterceptorTests {
|
||||
public Message<?> preSend(Message<?> message, MessageChannel channel) {
|
||||
assertNotNull(message);
|
||||
Message<?> reply = MessageBuilder.fromMessage(message)
|
||||
.setHeader(this.getClass().getName(), counter.incrementAndGet()).build();
|
||||
.setHeader(this.getClass().getSimpleName(), counter.incrementAndGet()).build();
|
||||
return reply;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user