INT-3242 Final Polish for 4.0.0.M2

- Rename EiMessageHeaderAccessor to IntegrationMessageHeaderAccessor
- Remove GenericMessage
- Minor TODOs
- Start a new What's new" chapter in the reference

JIRA: https://jira.springsource.org/browse/INT-3242
This commit is contained in:
Gary Russell
2013-12-17 14:38:36 -05:00
parent 64cc1faafe
commit c2ee2161a1
62 changed files with 995 additions and 1036 deletions

View File

@@ -24,7 +24,7 @@ import java.util.Map;
import org.springframework.amqp.core.MessageDeliveryMode;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.amqp.AmqpHeaders;
import org.springframework.integration.mapping.AbstractHeaderMapper;
import org.springframework.integration.mapping.support.JsonHeaders;
@@ -133,7 +133,7 @@ public class DefaultAmqpHeaderMapper extends AbstractHeaderMapper<MessagePropert
}
Integer priority = amqpMessageProperties.getPriority();
if (priority != null && priority > 0) {
headers.put(EiMessageHeaderAccessor.PRIORITY, priority);
headers.put(IntegrationMessageHeaderAccessor.PRIORITY, priority);
}
String receivedExchange = amqpMessageProperties.getReceivedExchange();
if (StringUtils.hasText(receivedExchange)) {
@@ -258,7 +258,7 @@ public class DefaultAmqpHeaderMapper extends AbstractHeaderMapper<MessagePropert
if (StringUtils.hasText(messageId)) {
amqpMessageProperties.setMessageId(messageId);
}
Integer priority = getHeaderIfAvailable(headers, EiMessageHeaderAccessor.PRIORITY, Integer.class);
Integer priority = getHeaderIfAvailable(headers, IntegrationMessageHeaderAccessor.PRIORITY, Integer.class);
if (priority != null) {
amqpMessageProperties.setPriority(priority);
}

View File

@@ -29,7 +29,7 @@ import org.springframework.util.Assert;
* @since 4.0
*
*/
public class EiMessageHeaderAccessor extends MessageHeaderAccessor {
public class IntegrationMessageHeaderAccessor extends MessageHeaderAccessor {
public static final String CORRELATION_ID = "correlationId";
@@ -45,7 +45,7 @@ public class EiMessageHeaderAccessor extends MessageHeaderAccessor {
public static final String POSTPROCESS_RESULT = "postProcessResult";
public EiMessageHeaderAccessor(Message<?> message) {
public IntegrationMessageHeaderAccessor(Message<?> message) {
super(message);
}
@@ -88,16 +88,16 @@ public class EiMessageHeaderAccessor extends MessageHeaderAccessor {
protected void verifyType(String headerName, Object headerValue) {
if (headerName != null && headerValue != null) {
super.verifyType(headerName, headerValue);
if (EiMessageHeaderAccessor.EXPIRATION_DATE.equals(headerName)) {
if (IntegrationMessageHeaderAccessor.EXPIRATION_DATE.equals(headerName)) {
Assert.isTrue(headerValue instanceof Date || headerValue instanceof Long, "The '" + headerName
+ "' header value must be a Date or Long.");
}
else if (EiMessageHeaderAccessor.SEQUENCE_NUMBER.equals(headerName)
|| EiMessageHeaderAccessor.SEQUENCE_SIZE.equals(headerName)) {
else if (IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER.equals(headerName)
|| IntegrationMessageHeaderAccessor.SEQUENCE_SIZE.equals(headerName)) {
Assert.isTrue(Integer.class.isAssignableFrom(headerValue.getClass()), "The '" + headerName
+ "' header value must be an Integer.");
}
else if (EiMessageHeaderAccessor.PRIORITY.equals(headerName)) {
else if (IntegrationMessageHeaderAccessor.PRIORITY.equals(headerName)) {
Assert.isTrue(Integer.class.isAssignableFrom(headerValue.getClass()), "The '" + headerName
+ "' header value must be an Integer.");
}

View File

@@ -20,7 +20,7 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.store.MessageGroup;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.messaging.Message;
@@ -68,7 +68,7 @@ public abstract class AbstractAggregatingMessageGroupProcessor implements Messag
MessageHeaders currentHeaders = message.getHeaders();
for (String key : currentHeaders.keySet()) {
if (MessageHeaders.ID.equals(key) || MessageHeaders.TIMESTAMP.equals(key)
|| EiMessageHeaderAccessor.SEQUENCE_SIZE.equals(key) || EiMessageHeaderAccessor.SEQUENCE_NUMBER.equals(key)) {
|| IntegrationMessageHeaderAccessor.SEQUENCE_SIZE.equals(key) || IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER.equals(key)) {
continue;
}
Object value = currentHeaders.get(key);

View File

@@ -23,7 +23,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.channel.NullChannel;
import org.springframework.integration.core.MessageProducer;
import org.springframework.integration.handler.AbstractMessageHandler;
@@ -104,7 +104,7 @@ public abstract class AbstractCorrelatingMessageHandler extends AbstractMessageH
setMessageStore(store);
this.outputProcessor = processor;
this.correlationStrategy = correlationStrategy == null ?
new HeaderAttributeCorrelationStrategy(EiMessageHeaderAccessor.CORRELATION_ID) : correlationStrategy;
new HeaderAttributeCorrelationStrategy(IntegrationMessageHeaderAccessor.CORRELATION_ID) : correlationStrategy;
this.releaseStrategy = releaseStrategy == null ? new SequenceSizeReleaseStrategy() : releaseStrategy;
this.messagingTemplate.setSendTimeout(DEFAULT_SEND_TIMEOUT);
sequenceAware = this.releaseStrategy instanceof SequenceSizeReleaseStrategy;
@@ -348,7 +348,7 @@ public abstract class AbstractCorrelatingMessageHandler extends AbstractMessageH
Message<?> lastReleasedMessage = sorted.get(partialSequence.size()-1);
return new EiMessageHeaderAccessor(lastReleasedMessage).getSequenceNumber();
return new IntegrationMessageHeaderAccessor(lastReleasedMessage).getSequenceNumber();
}
private MessageGroup store(Object correlationKey, Message<?> message) {
@@ -469,7 +469,7 @@ public abstract class AbstractCorrelatingMessageHandler extends AbstractMessageH
if (this.size() == 0) {
return true;
}
EiMessageHeaderAccessor messageHeaderAccessor = new EiMessageHeaderAccessor(message);
IntegrationMessageHeaderAccessor messageHeaderAccessor = new IntegrationMessageHeaderAccessor(message);
Integer messageSequenceNumber = messageHeaderAccessor.getSequenceNumber();
if (messageSequenceNumber != null && messageSequenceNumber > 0) {
Integer messageSequenceSize = messageHeaderAccessor.getSequenceSize();
@@ -485,7 +485,7 @@ public abstract class AbstractCorrelatingMessageHandler extends AbstractMessageH
private boolean containsSequenceNumber(Collection<Message<?>> messages, Integer messageSequenceNumber) {
for (Message<?> member : messages) {
Integer memberSequenceNumber = new EiMessageHeaderAccessor(member).getSequenceNumber();
Integer memberSequenceNumber = new IntegrationMessageHeaderAccessor(member).getSequenceNumber();
if (messageSequenceNumber.equals(memberSequenceNumber)) {
return true;
}

View File

@@ -18,7 +18,7 @@ package org.springframework.integration.aggregator;
import java.util.Comparator;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.messaging.Message;
/**
@@ -30,8 +30,8 @@ import org.springframework.messaging.Message;
public class MessageSequenceComparator implements Comparator<Message<?>> {
public int compare(Message<?> message1, Message<?> message2) {
Integer s1 = new EiMessageHeaderAccessor(message1).getSequenceNumber();
Integer s2 = new EiMessageHeaderAccessor(message2).getSequenceNumber();
Integer s1 = new IntegrationMessageHeaderAccessor(message1).getSequenceNumber();
Integer s2 = new IntegrationMessageHeaderAccessor(message2).getSequenceNumber();
if (s1 == null) {
s1 = 0;
}

View File

@@ -20,7 +20,7 @@ import java.util.Comparator;
import java.util.List;
import org.springframework.messaging.Message;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.store.MessageGroup;
/**
@@ -60,6 +60,6 @@ public class ResequencingMessageGroupProcessor implements MessageGroupProcessor
}
private Integer extractSequenceNumber(Message<?> message) {
return new EiMessageHeaderAccessor(message).getSequenceNumber();
return new IntegrationMessageHeaderAccessor(message).getSequenceNumber();
}
}

View File

@@ -16,7 +16,7 @@ package org.springframework.integration.aggregator;
import java.util.Collection;
import org.springframework.messaging.Message;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.store.MessageGroup;
import org.springframework.integration.store.MessageGroupStore;
@@ -53,7 +53,7 @@ public class ResequencingMessageHandler extends AbstractCorrelatingMessageHandle
int sequenceSize = 0;
Message<?> message = messageGroup.getOne();
if (message != null){
sequenceSize = new EiMessageHeaderAccessor(message).getSequenceSize();
sequenceSize = new IntegrationMessageHeaderAccessor(message).getSequenceSize();
}
// If there is no sequence then it must be incomplete or unbounded
if (sequenceSize > 0 && sequenceSize == size){

View File

@@ -15,7 +15,7 @@ package org.springframework.integration.aggregator;
import java.util.Comparator;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.messaging.Message;
/**
@@ -32,8 +32,8 @@ public class SequenceNumberComparator implements Comparator<Message<?>> {
* rank.
*/
public int compare(Message<?> o1, Message<?> o2) {
Integer sequenceNumber1 = new EiMessageHeaderAccessor(o1).getSequenceNumber();
Integer sequenceNumber2 = new EiMessageHeaderAccessor(o2).getSequenceNumber();
Integer sequenceNumber1 = new IntegrationMessageHeaderAccessor(o1).getSequenceNumber();
Integer sequenceNumber2 = new IntegrationMessageHeaderAccessor(o2).getSequenceNumber();
if (sequenceNumber1 == sequenceNumber2) {
return 0;
}

View File

@@ -25,7 +25,7 @@ import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.messaging.Message;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.store.MessageGroup;
/**
@@ -78,7 +78,7 @@ public class SequenceSizeReleaseStrategy implements ReleaseStrategy {
List<Message<?>> sorted = new ArrayList<Message<?>>(messages);
Collections.sort(sorted, comparator);
int nextSequenceNumber = new EiMessageHeaderAccessor(sorted.get(0)).getSequenceNumber();
int nextSequenceNumber = new IntegrationMessageHeaderAccessor(sorted.get(0)).getSequenceNumber();
int lastReleasedMessageSequence = messageGroup.getLastReleasedMessageSequenceNumber();
if (nextSequenceNumber - lastReleasedMessageSequence == 1){
@@ -92,7 +92,7 @@ public class SequenceSizeReleaseStrategy implements ReleaseStrategy {
canRelease = true;
}
else {
int sequenceSize = new EiMessageHeaderAccessor(messageGroup.getOne()).getSequenceSize();
int sequenceSize = new IntegrationMessageHeaderAccessor(messageGroup.getOne()).getSequenceSize();
// If there is no sequence then it must be incomplete....
if (sequenceSize == size){
canRelease = true;

View File

@@ -20,7 +20,7 @@ import java.util.Comparator;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.atomic.AtomicLong;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.util.UpperBound;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHeaders;
@@ -43,7 +43,7 @@ public class PriorityChannel extends QueueChannel {
* is a non-positive value, the queue will be unbounded. Message priority
* will be determined by the provided {@link Comparator}. If the comparator
* is <code>null</code>, the priority will be based upon the value of
* {@link EiMessageHeaderAccessor#getPriority()}.
* {@link IntegrationMessageHeaderAccessor#getPriority()}.
*/
public PriorityChannel(int capacity, Comparator<Message<?>> comparator) {
super(new PriorityBlockingQueue<Message<?>>(11, new SequenceFallbackComparator(comparator)));
@@ -52,7 +52,7 @@ public class PriorityChannel extends QueueChannel {
/**
* Create a channel with the specified queue capacity. Message priority
* will be based upon the value of {@link EiMessageHeaderAccessor#getPriority()}.
* will be based upon the value of {@link IntegrationMessageHeaderAccessor#getPriority()}.
*/
public PriorityChannel(int capacity) {
this(capacity, null);
@@ -62,7 +62,7 @@ public class PriorityChannel extends QueueChannel {
* Create a channel with an unbounded queue. Message priority will be
* determined by the provided {@link Comparator}. If the comparator
* is <code>null</code>, the priority will be based upon the value of
* {@link EiMessageHeaderAccessor#getPriority()}.
* {@link IntegrationMessageHeaderAccessor#getPriority()}.
*/
public PriorityChannel(Comparator<Message<?>> comparator) {
this(0, comparator);
@@ -70,7 +70,7 @@ public class PriorityChannel extends QueueChannel {
/**
* Create a channel with an unbounded queue. Message priority will be
* based on the value of {@link EiMessageHeaderAccessor#getPriority()}.
* based on the value of {@link IntegrationMessageHeaderAccessor#getPriority()}.
*/
public PriorityChannel() {
this(0, null);
@@ -109,8 +109,8 @@ public class PriorityChannel extends QueueChannel {
compareResult = this.targetComparator.compare(message1, message2);
}
else {
Integer priority1 = new EiMessageHeaderAccessor(message1).getPriority();
Integer priority2 = new EiMessageHeaderAccessor(message2).getPriority();
Integer priority1 = new IntegrationMessageHeaderAccessor(message1).getPriority();
Integer priority2 = new IntegrationMessageHeaderAccessor(message2).getPriority();
priority1 = priority1 != null ? priority1 : 0;
priority2 = priority2 != null ? priority2 : 0;

View File

@@ -18,7 +18,7 @@ package org.springframework.integration.config;
import java.lang.reflect.Method;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.aggregator.CorrelationStrategy;
import org.springframework.integration.aggregator.HeaderAttributeCorrelationStrategy;
import org.springframework.integration.aggregator.MethodInvokingCorrelationStrategy;
@@ -33,7 +33,7 @@ import org.springframework.util.StringUtils;
*/
public class CorrelationStrategyFactoryBean implements FactoryBean<CorrelationStrategy> {
private CorrelationStrategy delegate = new HeaderAttributeCorrelationStrategy(EiMessageHeaderAccessor.CORRELATION_ID);
private CorrelationStrategy delegate = new HeaderAttributeCorrelationStrategy(IntegrationMessageHeaderAccessor.CORRELATION_ID);
/**
* Create a factory and set up the delegate which clients of the factory will see as its product.

View File

@@ -20,7 +20,7 @@ import org.w3c.dom.Element;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.messaging.MessageHeaders;
import org.springframework.util.StringUtils;
@@ -39,9 +39,9 @@ public class StandardHeaderEnricherParser extends HeaderEnricherParserSupport {
public StandardHeaderEnricherParser() {
this.addElementToHeaderMapping("reply-channel", MessageHeaders.REPLY_CHANNEL);
this.addElementToHeaderMapping("error-channel", MessageHeaders.ERROR_CHANNEL);
this.addElementToHeaderMapping("correlation-id", EiMessageHeaderAccessor.CORRELATION_ID);
this.addElementToHeaderMapping("expiration-date", EiMessageHeaderAccessor.EXPIRATION_DATE, Long.class);
this.addElementToHeaderMapping("priority", EiMessageHeaderAccessor.PRIORITY, Integer.class);
this.addElementToHeaderMapping("correlation-id", IntegrationMessageHeaderAccessor.CORRELATION_ID);
this.addElementToHeaderMapping("expiration-date", IntegrationMessageHeaderAccessor.EXPIRATION_DATE, Long.class);
this.addElementToHeaderMapping("priority", IntegrationMessageHeaderAccessor.PRIORITY, Integer.class);
}
@Override

View File

@@ -34,7 +34,7 @@ import org.springframework.util.Assert;
* Two expressions 'onSuccessExpression' and 'onFailureExpression' are evaluated when
* appropriate. If the evaluation returns a result, a message is sent to the onSuccessChannel
* or onFailureChannel as appropriate; the message is the input message with a header
* {@link org.springframework.integration.EiMessageHeaderAccessor#POSTPROCESS_RESULT} containing the evaluation result.
* {@link org.springframework.integration.IntegrationMessageHeaderAccessor#POSTPROCESS_RESULT} containing the evaluation result.
* The failure expression is NOT evaluated if the success expression throws an exception.
* @author Gary Russell
* @since 2.2

View File

@@ -1,67 +0,0 @@
/*
* Copyright 2002-2013 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.message;
import java.util.Map;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHeaders;
/**
* Base Message class defining common properties such as id, payload, and headers.
* Once created this object is immutable.
*
* @author Mark Fisher
*
* @deprecated - use spring-messaging GenericMessage - this remains only until we migrate XD to the latest snapshot
*/
// TODO Remove
@Deprecated
public class GenericMessage<T> extends org.springframework.messaging.support.GenericMessage<T> implements Message<T> {
private static final long serialVersionUID = 3649200745084232821L;
/**
* Create a new message with the given payload.
*
* @param payload the message payload
*/
public GenericMessage(T payload) {
this(payload, null);
}
/**
* Create a new message with the given payload. The provided map
* will be used to populate the message headers
*
* @param payload the message payload
* @param headers message headers
* @see MessageHeaders
*/
public GenericMessage(T payload, Map<String, Object> headers) {
super(payload, headers);
}
protected MessageHeaders createMessageHeaders(Map<String, Object> headers) {
return new MessageHeaders(headers);
}
@Override
public MessageHeaders getHeaders() {
return super.getHeaders();
}
}

View File

@@ -17,7 +17,7 @@
package org.springframework.integration.selector;
import org.springframework.messaging.Message;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.core.MessageSelector;
/**
@@ -30,7 +30,7 @@ import org.springframework.integration.core.MessageSelector;
public class UnexpiredMessageSelector implements MessageSelector {
public boolean accept(Message<?> message) {
Long expirationDate = new EiMessageHeaderAccessor(message).getExpirationDate();
Long expirationDate = new IntegrationMessageHeaderAccessor(message).getExpirationDate();
if (expirationDate == null) {
return true;
}

View File

@@ -18,7 +18,7 @@ import java.util.Collections;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.messaging.Message;
/**
@@ -124,7 +124,7 @@ public class SimpleMessageGroup implements MessageGroup {
if (size() == 0) {
return 0;
}
return new EiMessageHeaderAccessor(getOne()).getSequenceSize();
return new IntegrationMessageHeaderAccessor(getOne()).getSequenceSize();
}
public int size() {

View File

@@ -22,8 +22,8 @@ import java.util.concurrent.atomic.AtomicLong;
import org.springframework.util.IdGenerator;
// TODO Discuss and agree where these should go. In SI or in Spring 4?
/**
* Alterative {@link IdGenerator} implementations.
*
* @author Andy Wilkinson
* @since 4.0
@@ -31,6 +31,10 @@ import org.springframework.util.IdGenerator;
*/
public class IdGenerators {
/**
* UUID.randomUUID()
*
*/
public static class JdkIdGenerator implements IdGenerator {
@Override
@@ -40,6 +44,10 @@ public class IdGenerators {
}
/**
* Begins with 1; incremented on each use.
*
*/
public static class SimpleIncrementingIdGenerator implements IdGenerator {
private final AtomicLong topBits = new AtomicLong();

View File

@@ -23,7 +23,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
@@ -41,7 +41,7 @@ public final class MessageBuilder<T> {
private final T payload;
private final EiMessageHeaderAccessor headerAccessor;
private final IntegrationMessageHeaderAccessor headerAccessor;
private final Message<T> originalMessage;
@@ -54,7 +54,7 @@ public final class MessageBuilder<T> {
Assert.notNull(payload, "payload must not be null");
this.payload = payload;
this.originalMessage = originalMessage;
this.headerAccessor = new EiMessageHeaderAccessor(originalMessage);
this.headerAccessor = new IntegrationMessageHeaderAccessor(originalMessage);
if (originalMessage != null) {
this.modified = (!this.payload.equals(originalMessage.getPayload()));
}
@@ -139,26 +139,26 @@ public final class MessageBuilder<T> {
}
public MessageBuilder<T> setExpirationDate(Long expirationDate) {
return this.setHeader(EiMessageHeaderAccessor.EXPIRATION_DATE, expirationDate);
return this.setHeader(IntegrationMessageHeaderAccessor.EXPIRATION_DATE, expirationDate);
}
public MessageBuilder<T> setExpirationDate(Date expirationDate) {
if (expirationDate != null) {
return this.setHeader(EiMessageHeaderAccessor.EXPIRATION_DATE, expirationDate.getTime());
return this.setHeader(IntegrationMessageHeaderAccessor.EXPIRATION_DATE, expirationDate.getTime());
}
else {
return this.setHeader(EiMessageHeaderAccessor.EXPIRATION_DATE, null);
return this.setHeader(IntegrationMessageHeaderAccessor.EXPIRATION_DATE, null);
}
}
public MessageBuilder<T> setCorrelationId(Object correlationId) {
return this.setHeader(EiMessageHeaderAccessor.CORRELATION_ID, correlationId);
return this.setHeader(IntegrationMessageHeaderAccessor.CORRELATION_ID, correlationId);
}
public MessageBuilder<T> pushSequenceDetails(Object correlationId, int sequenceNumber, int sequenceSize) {
Object incomingCorrelationId = this.headerAccessor.getCorrelationId();
@SuppressWarnings("unchecked")
List<List<Object>> incomingSequenceDetails = (List<List<Object>>) this.headerAccessor.getHeader(EiMessageHeaderAccessor.SEQUENCE_DETAILS);
List<List<Object>> incomingSequenceDetails = (List<List<Object>>) this.headerAccessor.getHeader(IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS);
if (incomingCorrelationId != null) {
if (incomingSequenceDetails == null) {
incomingSequenceDetails = new ArrayList<List<Object>>();
@@ -171,13 +171,13 @@ public final class MessageBuilder<T> {
incomingSequenceDetails = Collections.unmodifiableList(incomingSequenceDetails);
}
if (incomingSequenceDetails != null) {
setHeader(EiMessageHeaderAccessor.SEQUENCE_DETAILS, incomingSequenceDetails);
setHeader(IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS, incomingSequenceDetails);
}
return setCorrelationId(correlationId).setSequenceNumber(sequenceNumber).setSequenceSize(sequenceSize);
}
public MessageBuilder<T> popSequenceDetails() {
String key = EiMessageHeaderAccessor.SEQUENCE_DETAILS;
String key = IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS;
@SuppressWarnings("unchecked")
List<List<Object>> incomingSequenceDetails = (List<List<Object>>) this.headerAccessor.getHeader(key);
if (incomingSequenceDetails == null) {
@@ -198,10 +198,10 @@ public final class MessageBuilder<T> {
setSequenceSize(sequenceSize);
}
if (!incomingSequenceDetails.isEmpty()) {
this.headerAccessor.setHeader(EiMessageHeaderAccessor.SEQUENCE_DETAILS, incomingSequenceDetails);
this.headerAccessor.setHeader(IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS, incomingSequenceDetails);
}
else {
this.headerAccessor.removeHeader(EiMessageHeaderAccessor.SEQUENCE_DETAILS);
this.headerAccessor.removeHeader(IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS);
}
return this;
}
@@ -223,15 +223,15 @@ public final class MessageBuilder<T> {
}
public MessageBuilder<T> setSequenceNumber(Integer sequenceNumber) {
return this.setHeader(EiMessageHeaderAccessor.SEQUENCE_NUMBER, sequenceNumber);
return this.setHeader(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, sequenceNumber);
}
public MessageBuilder<T> setSequenceSize(Integer sequenceSize) {
return this.setHeader(EiMessageHeaderAccessor.SEQUENCE_SIZE, sequenceSize);
return this.setHeader(IntegrationMessageHeaderAccessor.SEQUENCE_SIZE, sequenceSize);
}
public MessageBuilder<T> setPriority(Integer priority) {
return this.setHeader(EiMessageHeaderAccessor.PRIORITY, priority);
return this.setHeader(IntegrationMessageHeaderAccessor.PRIORITY, priority);
}
@SuppressWarnings("unchecked")

View File

@@ -20,7 +20,7 @@ import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.mapping.InboundMessageMapper;
import org.springframework.util.Assert;
@@ -41,10 +41,10 @@ public abstract class AbstractJsonInboundMessageMapper<P> implements InboundMess
protected static final Map<String, Class<?>> DEFAULT_HEADER_TYPES = new HashMap<String, Class<?>>();
static {
DEFAULT_HEADER_TYPES.put(EiMessageHeaderAccessor.PRIORITY, Integer.class);
DEFAULT_HEADER_TYPES.put(EiMessageHeaderAccessor.EXPIRATION_DATE, Long.class);
DEFAULT_HEADER_TYPES.put(EiMessageHeaderAccessor.SEQUENCE_SIZE, Integer.class);
DEFAULT_HEADER_TYPES.put(EiMessageHeaderAccessor.SEQUENCE_NUMBER, Integer.class);
DEFAULT_HEADER_TYPES.put(IntegrationMessageHeaderAccessor.PRIORITY, Integer.class);
DEFAULT_HEADER_TYPES.put(IntegrationMessageHeaderAccessor.EXPIRATION_DATE, Long.class);
DEFAULT_HEADER_TYPES.put(IntegrationMessageHeaderAccessor.SEQUENCE_SIZE, Integer.class);
DEFAULT_HEADER_TYPES.put(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, Integer.class);
}
protected final Type payloadType;

View File

@@ -24,7 +24,7 @@ import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.core.convert.ConversionFailedException;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.integration.store.MessageGroup;
import org.springframework.integration.store.SimpleMessageGroup;
@@ -56,7 +56,7 @@ public class MethodInvokingReleaseStrategyTests {
@SuppressWarnings("unused")
public boolean checkCompletenessOnNonParameterizedListOfMessages(List<Message<?>> messages) {
Assert.assertTrue(messages.size() > 0);
return messages.size() > new EiMessageHeaderAccessor(messages.iterator().next()).getSequenceSize();
return messages.size() > new IntegrationMessageHeaderAccessor(messages.iterator().next()).getSequenceSize();
}
}
ReleaseStrategy adapter = new MethodInvokingReleaseStrategy(new TestReleaseStrategy(),
@@ -71,7 +71,7 @@ public class MethodInvokingReleaseStrategyTests {
@SuppressWarnings("unused")
public boolean checkCompletenessOnListOfMessagesParametrizedWithWildcard(List<Message<?>> messages) {
Assert.assertTrue(messages.size() > 0);
return messages.size() > new EiMessageHeaderAccessor(messages.iterator().next()).getSequenceSize();
return messages.size() > new IntegrationMessageHeaderAccessor(messages.iterator().next()).getSequenceSize();
}
}
ReleaseStrategy adapter = new MethodInvokingReleaseStrategy(new TestReleaseStrategy(),
@@ -86,7 +86,7 @@ public class MethodInvokingReleaseStrategyTests {
@SuppressWarnings("unused")
public boolean checkCompletenessOnListOfMessagesParametrizedWithString(List<Message<String>> messages) {
Assert.assertTrue(messages.size() > 0);
return messages.size() > new EiMessageHeaderAccessor(messages.iterator().next()).getSequenceSize();
return messages.size() > new IntegrationMessageHeaderAccessor(messages.iterator().next()).getSequenceSize();
}
}
ReleaseStrategy adapter = new MethodInvokingReleaseStrategy(new TestReleaseStrategy(),

View File

@@ -28,7 +28,7 @@ import java.util.Collections;
import org.junit.Before;
import org.junit.Test;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.store.MessageGroupStore;
import org.springframework.integration.store.SimpleMessageStore;
@@ -69,11 +69,11 @@ public class ResequencerTests {
Message<?> reply2 = replyChannel.receive(0);
Message<?> reply3 = replyChannel.receive(0);
assertNotNull(reply1);
assertThat( new EiMessageHeaderAccessor(reply1).getSequenceNumber(), is(1));
assertThat( new IntegrationMessageHeaderAccessor(reply1).getSequenceNumber(), is(1));
assertNotNull(reply2);
assertThat(new EiMessageHeaderAccessor(reply2).getSequenceNumber(), is(2));
assertThat(new IntegrationMessageHeaderAccessor(reply2).getSequenceNumber(), is(2));
assertNotNull(reply3);
assertThat( new EiMessageHeaderAccessor(reply3).getSequenceNumber(), is(3));
assertThat( new IntegrationMessageHeaderAccessor(reply3).getSequenceNumber(), is(3));
}
@Test
@@ -142,11 +142,11 @@ public class ResequencerTests {
Message<?> reply2 = replyChannel.receive(0);
Message<?> reply3 = replyChannel.receive(0);
assertNotNull(reply1);
assertEquals(new Integer(1), new EiMessageHeaderAccessor(reply1).getSequenceNumber());
assertEquals(new Integer(1), new IntegrationMessageHeaderAccessor(reply1).getSequenceNumber());
assertNotNull(reply2);
assertEquals(new Integer(2), new EiMessageHeaderAccessor(reply2).getSequenceNumber());
assertEquals(new Integer(2), new IntegrationMessageHeaderAccessor(reply2).getSequenceNumber());
assertNotNull(reply3);
assertEquals(new Integer(3), new EiMessageHeaderAccessor(reply3).getSequenceNumber());
assertEquals(new Integer(3), new IntegrationMessageHeaderAccessor(reply3).getSequenceNumber());
}
@Test
@@ -165,18 +165,18 @@ public class ResequencerTests {
Message<?> reply3 = replyChannel.receive(0);
// only messages 1 and 2 should have been received by now
assertNotNull(reply1);
assertEquals(new Integer(1), new EiMessageHeaderAccessor(reply1).getSequenceNumber());
assertEquals(new Integer(1), new IntegrationMessageHeaderAccessor(reply1).getSequenceNumber());
assertNotNull(reply2);
assertEquals(new Integer(2), new EiMessageHeaderAccessor(reply2).getSequenceNumber());
assertEquals(new Integer(2), new IntegrationMessageHeaderAccessor(reply2).getSequenceNumber());
assertNull(reply3);
// when sending the last message, the whole sequence must have been sent
this.resequencer.handleMessage(message4);
reply3 = replyChannel.receive(0);
Message<?> reply4 = replyChannel.receive(0);
assertNotNull(reply3);
assertEquals(new Integer(3), new EiMessageHeaderAccessor(reply3).getSequenceNumber());
assertEquals(new Integer(3), new IntegrationMessageHeaderAccessor(reply3).getSequenceNumber());
assertNotNull(reply4);
assertEquals(new Integer(4), new EiMessageHeaderAccessor(reply4).getSequenceNumber());
assertEquals(new Integer(4), new IntegrationMessageHeaderAccessor(reply4).getSequenceNumber());
}
@Test
@@ -195,18 +195,18 @@ public class ResequencerTests {
Message<?> reply3 = replyChannel.receive(0);
// only messages 1 and 2 should have been received by now
assertNotNull(reply1);
assertEquals(new Integer(1), new EiMessageHeaderAccessor(reply1).getSequenceNumber());
assertEquals(new Integer(1), new IntegrationMessageHeaderAccessor(reply1).getSequenceNumber());
assertNotNull(reply2);
assertEquals(new Integer(2), new EiMessageHeaderAccessor(reply2).getSequenceNumber());
assertEquals(new Integer(2), new IntegrationMessageHeaderAccessor(reply2).getSequenceNumber());
assertNull(reply3);
// when sending the last message, the whole sequence must have been sent
this.resequencer.handleMessage(message4);
reply3 = replyChannel.receive(0);
Message<?> reply4 = replyChannel.receive(0);
assertNotNull(reply3);
assertEquals(new Integer(3), new EiMessageHeaderAccessor(reply3).getSequenceNumber());
assertEquals(new Integer(3), new IntegrationMessageHeaderAccessor(reply3).getSequenceNumber());
assertNotNull(reply4);
assertEquals(new Integer(4), new EiMessageHeaderAccessor(reply4).getSequenceNumber());
assertEquals(new Integer(4), new IntegrationMessageHeaderAccessor(reply4).getSequenceNumber());
}
@Test
@@ -227,8 +227,8 @@ public class ResequencerTests {
assertNotNull(reply1);
assertNotNull(reply2);
assertNull(reply3);
ArrayList<Integer> sequence = new ArrayList<Integer>(Arrays.asList(new EiMessageHeaderAccessor(reply1).getSequenceNumber(),
new EiMessageHeaderAccessor(reply2).getSequenceNumber()));
ArrayList<Integer> sequence = new ArrayList<Integer>(Arrays.asList(new IntegrationMessageHeaderAccessor(reply1).getSequenceNumber(),
new IntegrationMessageHeaderAccessor(reply2).getSequenceNumber()));
Collections.sort(sequence);
assertEquals("[1, 2]", sequence.toString());
// when sending the last message, the whole sequence must have been sent
@@ -251,7 +251,7 @@ public class ResequencerTests {
Message<?> discard2 = discardChannel.receive(0);
// message2 has been discarded because it came in with the wrong sequence size
assertNotNull(discard1);
assertEquals(new Integer(1), new EiMessageHeaderAccessor(discard1).getSequenceNumber());
assertEquals(new Integer(1), new IntegrationMessageHeaderAccessor(discard1).getSequenceNumber());
assertNull(discard2);
}
@@ -292,13 +292,13 @@ public class ResequencerTests {
reply3 = replyChannel.receive(0);
Message<?> reply4 = replyChannel.receive(0);
assertNotNull(reply1);
assertEquals(new Integer(1), new EiMessageHeaderAccessor(reply1).getSequenceNumber());
assertEquals(new Integer(1), new IntegrationMessageHeaderAccessor(reply1).getSequenceNumber());
assertNotNull(reply2);
assertEquals(new Integer(2), new EiMessageHeaderAccessor(reply2).getSequenceNumber());
assertEquals(new Integer(2), new IntegrationMessageHeaderAccessor(reply2).getSequenceNumber());
assertNotNull(reply3);
assertEquals(new Integer(3), new EiMessageHeaderAccessor(reply3).getSequenceNumber());
assertEquals(new Integer(3), new IntegrationMessageHeaderAccessor(reply3).getSequenceNumber());
assertNotNull(reply4);
assertEquals(new Integer(4), new EiMessageHeaderAccessor(reply4).getSequenceNumber());
assertEquals(new Integer(4), new IntegrationMessageHeaderAccessor(reply4).getSequenceNumber());
}
@Test

View File

@@ -25,7 +25,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.PollableChannel;
@@ -60,9 +60,9 @@ public class AggregatorExpressionIntegrationTests {
private Map<String, Object> stubHeaders(int sequenceNumber, int sequenceSize, int correllationId) {
Map<String, Object> headers = new HashMap<String, Object>();
headers.put(EiMessageHeaderAccessor.SEQUENCE_NUMBER, sequenceNumber);
headers.put(EiMessageHeaderAccessor.SEQUENCE_SIZE, sequenceSize);
headers.put(EiMessageHeaderAccessor.CORRELATION_ID, correllationId);
headers.put(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, sequenceNumber);
headers.put(IntegrationMessageHeaderAccessor.SEQUENCE_SIZE, sequenceSize);
headers.put(IntegrationMessageHeaderAccessor.CORRELATION_ID, correllationId);
return headers;
}

View File

@@ -30,7 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.PollableChannel;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -129,9 +129,9 @@ public class AggregatorIntegrationTests {
private Map<String, Object> stubHeaders(int sequenceNumber, int sequenceSize, int correllationId) {
Map<String, Object> headers = new HashMap<String, Object>();
headers.put(EiMessageHeaderAccessor.SEQUENCE_NUMBER, sequenceNumber);
headers.put(EiMessageHeaderAccessor.SEQUENCE_SIZE, sequenceSize);
headers.put(EiMessageHeaderAccessor.CORRELATION_ID, correllationId);
headers.put(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, sequenceNumber);
headers.put(IntegrationMessageHeaderAccessor.SEQUENCE_SIZE, sequenceSize);
headers.put(IntegrationMessageHeaderAccessor.CORRELATION_ID, correllationId);
return headers;
}

View File

@@ -30,7 +30,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.PollableChannel;
@@ -70,9 +70,9 @@ public class DefaultMessageAggregatorIntegrationTests {
private Map<String, Object> stubHeaders(int sequenceNumber, int sequenceSize, int correllationId) {
Map<String, Object> headers = new HashMap<String, Object>();
headers.put(EiMessageHeaderAccessor.SEQUENCE_NUMBER, sequenceNumber);
headers.put(EiMessageHeaderAccessor.SEQUENCE_SIZE, sequenceSize);
headers.put(EiMessageHeaderAccessor.CORRELATION_ID, correllationId);
headers.put(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, sequenceNumber);
headers.put(IntegrationMessageHeaderAccessor.SEQUENCE_SIZE, sequenceSize);
headers.put(IntegrationMessageHeaderAccessor.CORRELATION_ID, correllationId);
return headers;
}

View File

@@ -21,7 +21,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.aggregator.ResequencingMessageHandler;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.endpoint.EventDrivenConsumer;
@@ -60,15 +60,15 @@ public class ResequencerIntegrationTests {
inputChannel.send(message1);
message1 = outputChannel.receive(0);
assertNotNull(message1);
assertEquals((Integer)1, new EiMessageHeaderAccessor(message1).getSequenceNumber());
assertEquals((Integer)1, new IntegrationMessageHeaderAccessor(message1).getSequenceNumber());
inputChannel.send(message2);
message2 = outputChannel.receive(0);
message3 = outputChannel.receive(0);
assertNotNull(message2);
assertNotNull(message3);
assertEquals((Integer)2, new EiMessageHeaderAccessor(message2).getSequenceNumber());
assertEquals((Integer)3, new EiMessageHeaderAccessor(message3).getSequenceNumber());
assertEquals((Integer)2, new IntegrationMessageHeaderAccessor(message2).getSequenceNumber());
assertEquals((Integer)3, new IntegrationMessageHeaderAccessor(message3).getSequenceNumber());
inputChannel.send(message5);
assertNull(outputChannel.receive(0));
@@ -83,9 +83,9 @@ public class ResequencerIntegrationTests {
assertNotNull(message4);
assertNotNull(message5);
assertNotNull(message6);
assertEquals((Integer)4, new EiMessageHeaderAccessor(message4).getSequenceNumber());
assertEquals((Integer)5, new EiMessageHeaderAccessor(message5).getSequenceNumber());
assertEquals((Integer)6, new EiMessageHeaderAccessor(message6).getSequenceNumber());
assertEquals((Integer)4, new IntegrationMessageHeaderAccessor(message4).getSequenceNumber());
assertEquals((Integer)5, new IntegrationMessageHeaderAccessor(message5).getSequenceNumber());
assertEquals((Integer)6, new IntegrationMessageHeaderAccessor(message6).getSequenceNumber());
assertEquals(0, store.getMessageGroup("A").getMessages().size());

View File

@@ -24,7 +24,7 @@ import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessagingException;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -64,8 +64,8 @@ public class PartialSequencesWithGapsTests {
in.send(message(6, 6));
in.send(message(2, 6));
in.send(message(1, 6));
assertThat(new EiMessageHeaderAccessor(received.poll()).getSequenceNumber(), is(1));
assertThat(new EiMessageHeaderAccessor(received.poll()).getSequenceNumber(), is(2));
assertThat(new IntegrationMessageHeaderAccessor(received.poll()).getSequenceNumber(), is(1));
assertThat(new IntegrationMessageHeaderAccessor(received.poll()).getSequenceNumber(), is(2));
received.poll();
received.poll();
in.send(message(5, 6));

View File

@@ -48,7 +48,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.MessageRejectedException;
import org.springframework.integration.endpoint.AbstractEndpoint;
import org.springframework.integration.gateway.GatewayProxyFactoryBean;
@@ -192,7 +192,7 @@ public class ChainParserTests {
Message<?> reply = this.replyOutput.receive(1000);
assertNotNull(reply);
assertEquals("foo", reply.getPayload());
assertEquals("ABC", new EiMessageHeaderAccessor(reply).getCorrelationId());
assertEquals("ABC", new IntegrationMessageHeaderAccessor(reply).getCorrelationId());
assertEquals("XYZ", reply.getHeaders().get("testValue"));
assertEquals(123, reply.getHeaders().get("testRef"));
}

View File

@@ -26,7 +26,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.PollableChannel;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.store.MessageGroupStore;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.test.context.ContextConfiguration;
@@ -64,11 +64,11 @@ public class ResequencerWithMessageStoreParserTests {
Message<?> message3 = output.receive(500);
assertNotNull(message1);
assertEquals(new Integer(1), new EiMessageHeaderAccessor(message1).getSequenceNumber());
assertEquals(new Integer(1), new IntegrationMessageHeaderAccessor(message1).getSequenceNumber());
assertNotNull(message2);
assertEquals(new Integer(2), new EiMessageHeaderAccessor(message2).getSequenceNumber());
assertEquals(new Integer(2), new IntegrationMessageHeaderAccessor(message2).getSequenceNumber());
assertNotNull(message3);
assertEquals(new Integer(3), new EiMessageHeaderAccessor(message3).getSequenceNumber());
assertEquals(new Integer(3), new IntegrationMessageHeaderAccessor(message3).getSequenceNumber());
}

View File

@@ -23,7 +23,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.springframework.messaging.Message;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.aggregator.MessageSequenceComparator;
import org.springframework.integration.annotation.Aggregator;
import org.springframework.messaging.support.GenericMessage;
@@ -45,7 +45,7 @@ public class TestAggregatorBean {
for (Message<?> message : sortableList) {
buffer.append(message.getPayload().toString());
if (null == correlationId) {
correlationId = new EiMessageHeaderAccessor(message).getCorrelationId();
correlationId = new IntegrationMessageHeaderAccessor(message).getCorrelationId();
}
}
Message<?> returnedMessage = new GenericMessage<String>(buffer.toString());

View File

@@ -23,7 +23,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.springframework.messaging.Message;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.aggregator.MessageSequenceComparator;
import org.springframework.integration.annotation.Aggregator;
import org.springframework.messaging.support.GenericMessage;
@@ -51,7 +51,7 @@ public class TestAnnotatedEndpointWithCustomizedAggregator {
for (Message<?> message : sortableList) {
buffer.append(message.getPayload().toString());
if (null == correlationId) {
correlationId = new EiMessageHeaderAccessor(message).getCorrelationId();
correlationId = new IntegrationMessageHeaderAccessor(message).getCorrelationId();
}
}
Message<?> returnedMessage = new GenericMessage<String>(buffer.toString());

View File

@@ -23,7 +23,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.springframework.messaging.Message;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.aggregator.MessageSequenceComparator;
import org.springframework.integration.annotation.Aggregator;
import org.springframework.integration.annotation.MessageEndpoint;
@@ -46,7 +46,7 @@ public class TestAnnotatedEndpointWithDefaultAggregator {
for (Message<?> message : sortableList) {
buffer.append(message.getPayload().toString());
if (null == correlationId) {
correlationId =new EiMessageHeaderAccessor(message).getCorrelationId();
correlationId =new IntegrationMessageHeaderAccessor(message).getCorrelationId();
}
}
Message<?> returnedMessage = new GenericMessage<String>(buffer.toString());

View File

@@ -23,7 +23,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.springframework.messaging.Message;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.aggregator.MessageSequenceComparator;
import org.springframework.integration.annotation.Aggregator;
import org.springframework.integration.annotation.MessageEndpoint;
@@ -47,7 +47,7 @@ public class TestAnnotatedEndpointWithReleaseStrategy {
for (Message<?> message : sortableList) {
buffer.append(message.getPayload().toString());
if (null == correlationId) {
correlationId = new EiMessageHeaderAccessor(message).getCorrelationId();
correlationId = new IntegrationMessageHeaderAccessor(message).getCorrelationId();
}
}
Message<?> returnedMessage = new GenericMessage<String>(buffer.toString());

View File

@@ -24,7 +24,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.integration.support.MessageBuilder;
@@ -146,7 +146,7 @@ public class HeaderEnricherOverwriteTests {
template.setDefaultDestination(channel);
Message<?> result = template.sendAndReceive(new GenericMessage<String>("test"));
assertNotNull(result);
assertEquals(new Integer(42), new EiMessageHeaderAccessor(result).getPriority());
assertEquals(new Integer(42), new IntegrationMessageHeaderAccessor(result).getPriority());
}
@Test
@@ -160,7 +160,7 @@ public class HeaderEnricherOverwriteTests {
input.send(message);
Message<?> result = replyChannel.receive(0);
assertNotNull(result);
assertEquals(new Integer(77), new EiMessageHeaderAccessor(result).getPriority());
assertEquals(new Integer(77), new IntegrationMessageHeaderAccessor(result).getPriority());
}
@Test

View File

@@ -29,7 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.integration.transformer.MessageTransformationException;
@@ -105,7 +105,7 @@ public class HeaderEnricherTests {
MessageChannel channel = context.getBean("correlationIdValueInput", MessageChannel.class);
Message<?> result = template.sendAndReceive(channel, new GenericMessage<String>("test"));
assertNotNull(result);
assertEquals("ABC", new EiMessageHeaderAccessor(result).getCorrelationId());
assertEquals("ABC", new IntegrationMessageHeaderAccessor(result).getCorrelationId());
}
@Test
@@ -114,7 +114,7 @@ public class HeaderEnricherTests {
MessageChannel channel = context.getBean("correlationIdValueWithTypeInput", MessageChannel.class);
Message<?> result = template.sendAndReceive(channel, new GenericMessage<String>("test"));
assertNotNull(result);
Object correlationId = new EiMessageHeaderAccessor(result).getCorrelationId();
Object correlationId = new IntegrationMessageHeaderAccessor(result).getCorrelationId();
assertEquals(Long.class, correlationId.getClass());
assertEquals(new Long(123), correlationId);
}
@@ -125,7 +125,7 @@ public class HeaderEnricherTests {
MessageChannel channel = context.getBean("correlationIdRefInput", MessageChannel.class);
Message<?> result = template.sendAndReceive(channel, new GenericMessage<String>("test"));
assertNotNull(result);
assertEquals(new Integer(123), new EiMessageHeaderAccessor(result).getCorrelationId());
assertEquals(new Integer(123), new IntegrationMessageHeaderAccessor(result).getCorrelationId());
}
@Test
@@ -134,7 +134,7 @@ public class HeaderEnricherTests {
MessageChannel channel = context.getBean("expirationDateValueInput", MessageChannel.class);
Message<?> result = template.sendAndReceive(channel, new GenericMessage<String>("test"));
assertNotNull(result);
assertEquals(new Long(1111), new EiMessageHeaderAccessor(result).getExpirationDate());
assertEquals(new Long(1111), new IntegrationMessageHeaderAccessor(result).getExpirationDate());
}
@Test
@@ -143,7 +143,7 @@ public class HeaderEnricherTests {
MessageChannel channel = context.getBean("expirationDateRefInput", MessageChannel.class);
Message<?> result = template.sendAndReceive(channel, new GenericMessage<String>("test"));
assertNotNull(result);
assertEquals(new Long(9999), new EiMessageHeaderAccessor(result).getExpirationDate());
assertEquals(new Long(9999), new IntegrationMessageHeaderAccessor(result).getExpirationDate());
}
@Test
@@ -152,7 +152,7 @@ public class HeaderEnricherTests {
MessageChannel channel = context.getBean("priorityInput", MessageChannel.class);
Message<?> result = template.sendAndReceive(channel, new GenericMessage<String>("test"));
assertNotNull(result);
assertEquals(new Integer(42), new EiMessageHeaderAccessor(result).getPriority());
assertEquals(new Integer(42), new IntegrationMessageHeaderAccessor(result).getPriority());
}
@Test

View File

@@ -35,7 +35,7 @@ import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.io.InputStreamResource;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.endpoint.EventDrivenConsumer;
import org.springframework.messaging.support.GenericMessage;
@@ -282,9 +282,9 @@ public class InnerDefinitionHandlerAwareEndpointParserTests {
private Map<String, Object> stubHeaders(int sequenceNumber, int sequenceSize, int correllationId) {
Map<String, Object> headers = new HashMap<String, Object>();
headers.put(EiMessageHeaderAccessor.SEQUENCE_NUMBER, sequenceNumber);
headers.put(EiMessageHeaderAccessor.SEQUENCE_SIZE, sequenceSize);
headers.put(EiMessageHeaderAccessor.CORRELATION_ID, correllationId);
headers.put(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, sequenceNumber);
headers.put(IntegrationMessageHeaderAccessor.SEQUENCE_SIZE, sequenceSize);
headers.put(IntegrationMessageHeaderAccessor.CORRELATION_ID, correllationId);
return headers;
}

View File

@@ -38,7 +38,7 @@ import org.springframework.core.task.TaskExecutor;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessagingException;
import org.springframework.messaging.MessageHandler;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.integration.support.MessageBuilder;
@@ -250,10 +250,10 @@ public class BroadcastingDispatcherTests {
dispatcher.addHandler(target2);
dispatcher.dispatch(new GenericMessage<String>("test"));
assertEquals(2, messages.size());
assertEquals(0, (int) new EiMessageHeaderAccessor(messages.get(0)).getSequenceNumber());
assertEquals(0, (int) new EiMessageHeaderAccessor(messages.get(0)).getSequenceSize());
assertEquals(0, (int) new EiMessageHeaderAccessor(messages.get(1)).getSequenceNumber());
assertEquals(0, (int) new EiMessageHeaderAccessor(messages.get(1)).getSequenceSize());
assertEquals(0, (int) new IntegrationMessageHeaderAccessor(messages.get(0)).getSequenceNumber());
assertEquals(0, (int) new IntegrationMessageHeaderAccessor(messages.get(0)).getSequenceSize());
assertEquals(0, (int) new IntegrationMessageHeaderAccessor(messages.get(1)).getSequenceNumber());
assertEquals(0, (int) new IntegrationMessageHeaderAccessor(messages.get(1)).getSequenceSize());
}
@Test
@@ -271,15 +271,15 @@ public class BroadcastingDispatcherTests {
Object originalId = inputMessage.getHeaders().getId();
dispatcher.dispatch(inputMessage);
assertEquals(3, messages.size());
assertEquals(1, (int) new EiMessageHeaderAccessor(messages.get(0)).getSequenceNumber());
assertEquals(3, (int) new EiMessageHeaderAccessor(messages.get(0)).getSequenceSize());
assertEquals(originalId, new EiMessageHeaderAccessor(messages.get(0)).getCorrelationId());
assertEquals(2, (int) new EiMessageHeaderAccessor(messages.get(1)).getSequenceNumber());
assertEquals(3, (int) new EiMessageHeaderAccessor(messages.get(1)).getSequenceSize());
assertEquals(originalId, new EiMessageHeaderAccessor(messages.get(1)).getCorrelationId());
assertEquals(3, (int) new EiMessageHeaderAccessor(messages.get(2)).getSequenceNumber());
assertEquals(3, (int) new EiMessageHeaderAccessor(messages.get(2)).getSequenceSize());
assertEquals(originalId, new EiMessageHeaderAccessor(messages.get(2)).getCorrelationId());
assertEquals(1, (int) new IntegrationMessageHeaderAccessor(messages.get(0)).getSequenceNumber());
assertEquals(3, (int) new IntegrationMessageHeaderAccessor(messages.get(0)).getSequenceSize());
assertEquals(originalId, new IntegrationMessageHeaderAccessor(messages.get(0)).getCorrelationId());
assertEquals(2, (int) new IntegrationMessageHeaderAccessor(messages.get(1)).getSequenceNumber());
assertEquals(3, (int) new IntegrationMessageHeaderAccessor(messages.get(1)).getSequenceSize());
assertEquals(originalId, new IntegrationMessageHeaderAccessor(messages.get(1)).getCorrelationId());
assertEquals(3, (int) new IntegrationMessageHeaderAccessor(messages.get(2)).getSequenceNumber());
assertEquals(3, (int) new IntegrationMessageHeaderAccessor(messages.get(2)).getSequenceSize());
assertEquals(originalId, new IntegrationMessageHeaderAccessor(messages.get(2)).getCorrelationId());
}
/**

View File

@@ -21,7 +21,7 @@ import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.springframework.messaging.Message;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.handler.ServiceActivatingHandler;
@@ -48,7 +48,7 @@ public class CorrelationIdTests {
endpoint.start();
assertTrue(inputChannel.send(message));
Message<?> reply = outputChannel.receive(0);
assertEquals(correlationId, new EiMessageHeaderAccessor(reply).getCorrelationId());
assertEquals(correlationId, new IntegrationMessageHeaderAccessor(reply).getCorrelationId());
}
@Test
@@ -63,8 +63,8 @@ public class CorrelationIdTests {
endpoint.start();
assertTrue(inputChannel.send(message));
Message<?> reply = outputChannel.receive(0);
assertEquals(new EiMessageHeaderAccessor(message).getCorrelationId(), new EiMessageHeaderAccessor(reply).getCorrelationId());
assertTrue(new EiMessageHeaderAccessor(message).getCorrelationId().equals(new EiMessageHeaderAccessor(reply).getCorrelationId()));
assertEquals(new IntegrationMessageHeaderAccessor(message).getCorrelationId(), new IntegrationMessageHeaderAccessor(reply).getCorrelationId());
assertTrue(new IntegrationMessageHeaderAccessor(message).getCorrelationId().equals(new IntegrationMessageHeaderAccessor(reply).getCorrelationId()));
}
@Test
@@ -80,7 +80,7 @@ public class CorrelationIdTests {
endpoint.start();
assertTrue(inputChannel.send(message));
Message<?> reply = outputChannel.receive(0);
assertEquals("456-XYZ", new EiMessageHeaderAccessor(reply).getCorrelationId());
assertEquals("456-XYZ", new IntegrationMessageHeaderAccessor(reply).getCorrelationId());
}
@Test
@@ -94,7 +94,7 @@ public class CorrelationIdTests {
endpoint.start();
assertTrue(inputChannel.send(message));
Message<?> reply = outputChannel.receive(0);
assertEquals("456-XYZ", new EiMessageHeaderAccessor(reply).getCorrelationId());
assertEquals("456-XYZ", new IntegrationMessageHeaderAccessor(reply).getCorrelationId());
}
@Test
@@ -107,8 +107,8 @@ public class CorrelationIdTests {
splitter.handleMessage(message);
Message<?> reply1 = testChannel.receive(100);
Message<?> reply2 = testChannel.receive(100);
assertEquals(message.getHeaders().getId(), new EiMessageHeaderAccessor(reply1).getCorrelationId());
assertEquals(message.getHeaders().getId(), new EiMessageHeaderAccessor(reply2).getCorrelationId());
assertEquals(message.getHeaders().getId(), new IntegrationMessageHeaderAccessor(reply1).getCorrelationId());
assertEquals(message.getHeaders().getId(), new IntegrationMessageHeaderAccessor(reply2).getCorrelationId());
}
@Test
@@ -123,10 +123,10 @@ public class CorrelationIdTests {
splitter.handleMessage(message);
Message<?> reply1 = testChannel.receive(100);
Message<?> reply2 = testChannel.receive(100);
assertEquals(message.getHeaders().getId(), new EiMessageHeaderAccessor(reply1).getCorrelationId());
assertEquals(message.getHeaders().getId(), new EiMessageHeaderAccessor(reply2).getCorrelationId());
assertTrue("Sequence details missing", reply1.getHeaders().containsKey(EiMessageHeaderAccessor.SEQUENCE_DETAILS));
assertTrue("Sequence details missing", reply2.getHeaders().containsKey(EiMessageHeaderAccessor.SEQUENCE_DETAILS));
assertEquals(message.getHeaders().getId(), new IntegrationMessageHeaderAccessor(reply1).getCorrelationId());
assertEquals(message.getHeaders().getId(), new IntegrationMessageHeaderAccessor(reply2).getCorrelationId());
assertTrue("Sequence details missing", reply1.getHeaders().containsKey(IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS));
assertTrue("Sequence details missing", reply2.getHeaders().containsKey(IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS));
}
@SuppressWarnings("unused")

View File

@@ -22,7 +22,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import org.junit.Test;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.channel.TestChannelResolver;
import org.springframework.integration.handler.ReplyRequiredException;
@@ -178,7 +178,7 @@ public class ServiceActivatorEndpointTests {
.setReplyChannel(replyChannel).build();
endpoint.handleMessage(message);
Message<?> reply = replyChannel.receive(500);
assertNull(new EiMessageHeaderAccessor(reply).getCorrelationId());
assertNull(new IntegrationMessageHeaderAccessor(reply).getCorrelationId());
}
@Test
@@ -195,7 +195,7 @@ public class ServiceActivatorEndpointTests {
.setReplyChannel(replyChannel).build();
endpoint.handleMessage(message);
Message<?> reply = replyChannel.receive(500);
Object correlationId = new EiMessageHeaderAccessor(reply).getCorrelationId();
Object correlationId = new IntegrationMessageHeaderAccessor(reply).getCorrelationId();
assertFalse(message.getHeaders().getId().equals(correlationId));
assertEquals("ABC-123", correlationId);
}

View File

@@ -22,7 +22,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.annotation.Header;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -49,7 +49,7 @@ public class GatewayWithHeaderAnnotations {
public static interface TestService {
// wrt INT-1205, priority no longer has a $ prefix, so here we are testing the $custom header as well
public String test(String str, @Header(EiMessageHeaderAccessor.PRIORITY) int priority, @Header("$custom") String custom);
public String test(String str, @Header(IntegrationMessageHeaderAccessor.PRIORITY) int priority, @Header("$custom") String custom);
}
}

View File

@@ -20,7 +20,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.annotation.Header;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.support.MessageBuilder;
@@ -46,7 +46,7 @@ public class HeaderAnnotationTransformerTests {
Message<?> result = outputChannel.receive(0);
assertNotNull(result);
assertEquals("testabc", result.getPayload());
assertEquals("abc", new EiMessageHeaderAccessor(result).getCorrelationId());
assertEquals("abc", new IntegrationMessageHeaderAccessor(result).getCorrelationId());
}
@Test // INT-1082
@@ -61,7 +61,7 @@ public class HeaderAnnotationTransformerTests {
Message<?> result = outputChannel.receive(0);
assertNotNull(result);
assertEquals("ABC", result.getPayload());
assertEquals("abc", new EiMessageHeaderAccessor(result).getCorrelationId());
assertEquals("abc", new IntegrationMessageHeaderAccessor(result).getCorrelationId());
}
@Test
@@ -98,7 +98,7 @@ public class HeaderAnnotationTransformerTests {
public static class TestTransformer {
public String appendCorrelationId(Object payload,
@Header(value = EiMessageHeaderAccessor.CORRELATION_ID, required = true) Object correlationId) {
@Header(value = IntegrationMessageHeaderAccessor.CORRELATION_ID, required = true) Object correlationId) {
return payload.toString() + correlationId.toString();
}
@@ -106,7 +106,7 @@ public class HeaderAnnotationTransformerTests {
return payload.toString() + header.toString();
}
public String evalCorrelationId(@Header(value = EiMessageHeaderAccessor.CORRELATION_ID + ".toUpperCase()") String result) {
public String evalCorrelationId(@Header(value = IntegrationMessageHeaderAccessor.CORRELATION_ID + ".toUpperCase()") String result) {
return result.toString();
}

View File

@@ -23,7 +23,7 @@ import java.util.Map;
import org.junit.Test;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.messaging.support.GenericMessage;
/**
@@ -36,13 +36,13 @@ public class GenericMessageTests {
Map<String, Object> headerMap = new HashMap<String, Object>();
headerMap.put("testAttribute", new Integer(123));
headerMap.put("testProperty", "foo");
headerMap.put(EiMessageHeaderAccessor.SEQUENCE_SIZE, 42);
headerMap.put(EiMessageHeaderAccessor.SEQUENCE_NUMBER, 24);
headerMap.put(IntegrationMessageHeaderAccessor.SEQUENCE_SIZE, 42);
headerMap.put(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, 24);
GenericMessage<String> message = new GenericMessage<String>("test", headerMap);
assertEquals(new Integer(123), message.getHeaders().get("testAttribute"));
assertEquals("foo", message.getHeaders().get("testProperty", String.class));
assertEquals(new Integer(42), new EiMessageHeaderAccessor(message).getSequenceSize());
assertEquals(new Integer(24), new EiMessageHeaderAccessor(message).getSequenceNumber());
assertEquals(new Integer(42), new IntegrationMessageHeaderAccessor(message).getSequenceSize());
assertEquals(new Integer(24), new IntegrationMessageHeaderAccessor(message).getSequenceNumber());
}
}

View File

@@ -29,7 +29,7 @@ import java.util.UUID;
import org.junit.Test;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHeaders;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.support.MessageBuilder;
/**
@@ -123,7 +123,7 @@ public class MessageBuilderTests {
public void testPriority() {
Message<Integer> importantMessage = MessageBuilder.withPayload(1)
.setPriority(123).build();
assertEquals(new Integer(123), new EiMessageHeaderAccessor(importantMessage).getPriority());
assertEquals(new Integer(123), new IntegrationMessageHeaderAccessor(importantMessage).getPriority());
}
@Test
@@ -131,9 +131,9 @@ public class MessageBuilderTests {
Message<Integer> message1 = MessageBuilder.withPayload(1)
.setPriority(42).build();
Message<Integer> message2 = MessageBuilder.fromMessage(message1)
.setHeaderIfAbsent(EiMessageHeaderAccessor.PRIORITY, 13)
.setHeaderIfAbsent(IntegrationMessageHeaderAccessor.PRIORITY, 13)
.build();
assertEquals(new Integer(42), new EiMessageHeaderAccessor(message2).getPriority());
assertEquals(new Integer(42), new IntegrationMessageHeaderAccessor(message2).getPriority());
}
@Test
@@ -141,7 +141,7 @@ public class MessageBuilderTests {
Long past = System.currentTimeMillis() - (60 * 1000);
Message<Integer> expiredMessage = MessageBuilder.withPayload(1)
.setExpirationDate(past).build();
assertEquals(past, new EiMessageHeaderAccessor(expiredMessage).getExpirationDate());
assertEquals(past, new IntegrationMessageHeaderAccessor(expiredMessage).getExpirationDate());
}
@Test
@@ -149,7 +149,7 @@ public class MessageBuilderTests {
Long past = System.currentTimeMillis() - (60 * 1000);
Message<Integer> expiredMessage = MessageBuilder.withPayload(1)
.setExpirationDate(new Date(past)).build();
assertEquals(past, new EiMessageHeaderAccessor(expiredMessage).getExpirationDate());
assertEquals(past, new IntegrationMessageHeaderAccessor(expiredMessage).getExpirationDate());
}
@Test
@@ -175,39 +175,39 @@ public class MessageBuilderTests {
@Test
public void testPushAndPopSequenceDetails() throws Exception {
Message<Integer> message1 = MessageBuilder.withPayload(1).pushSequenceDetails("foo", 1, 2).build();
assertFalse(message1.getHeaders().containsKey(EiMessageHeaderAccessor.SEQUENCE_DETAILS));
assertFalse(message1.getHeaders().containsKey(IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS));
Message<Integer> message2 = MessageBuilder.fromMessage(message1).pushSequenceDetails("bar", 1, 1).build();
assertTrue(message2.getHeaders().containsKey(EiMessageHeaderAccessor.SEQUENCE_DETAILS));
assertTrue(message2.getHeaders().containsKey(IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS));
Message<Integer> message3 = MessageBuilder.fromMessage(message2).popSequenceDetails().build();
assertFalse(message3.getHeaders().containsKey(EiMessageHeaderAccessor.SEQUENCE_DETAILS));
assertFalse(message3.getHeaders().containsKey(IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS));
}
@Test
public void testPushAndPopSequenceDetailsWhenNoCorrelationId() throws Exception {
Message<Integer> message1 = MessageBuilder.withPayload(1).build();
assertFalse(message1.getHeaders().containsKey(EiMessageHeaderAccessor.SEQUENCE_DETAILS));
assertFalse(message1.getHeaders().containsKey(IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS));
Message<Integer> message2 = MessageBuilder.fromMessage(message1).pushSequenceDetails("bar", 1, 1).build();
assertFalse(message2.getHeaders().containsKey(EiMessageHeaderAccessor.SEQUENCE_DETAILS));
assertFalse(message2.getHeaders().containsKey(IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS));
Message<Integer> message3 = MessageBuilder.fromMessage(message2).popSequenceDetails().build();
assertFalse(message3.getHeaders().containsKey(EiMessageHeaderAccessor.SEQUENCE_DETAILS));
assertFalse(message3.getHeaders().containsKey(IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS));
}
@Test
public void testPopSequenceDetailsWhenNotPopped() throws Exception {
Message<Integer> message1 = MessageBuilder.withPayload(1).build();
assertFalse(message1.getHeaders().containsKey(EiMessageHeaderAccessor.SEQUENCE_DETAILS));
assertFalse(message1.getHeaders().containsKey(IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS));
Message<Integer> message2 = MessageBuilder.fromMessage(message1).popSequenceDetails().build();
assertFalse(message2.getHeaders().containsKey(EiMessageHeaderAccessor.SEQUENCE_DETAILS));
assertFalse(message2.getHeaders().containsKey(IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS));
}
@Test
public void testPushAndPopSequenceDetailsWhenNoSequence() throws Exception {
Message<Integer> message1 = MessageBuilder.withPayload(1).setCorrelationId("foo").build();
assertFalse(message1.getHeaders().containsKey(EiMessageHeaderAccessor.SEQUENCE_DETAILS));
assertFalse(message1.getHeaders().containsKey(IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS));
Message<Integer> message2 = MessageBuilder.fromMessage(message1).pushSequenceDetails("bar", 1, 1).build();
assertTrue(message2.getHeaders().containsKey(EiMessageHeaderAccessor.SEQUENCE_DETAILS));
assertTrue(message2.getHeaders().containsKey(IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS));
Message<Integer> message3 = MessageBuilder.fromMessage(message2).popSequenceDetails().build();
assertFalse(message3.getHeaders().containsKey(EiMessageHeaderAccessor.SEQUENCE_DETAILS));
assertFalse(message3.getHeaders().containsKey(IntegrationMessageHeaderAccessor.SEQUENCE_DETAILS));
}
@Test

View File

@@ -26,7 +26,7 @@ import java.util.List;
import org.junit.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.core.MessageSelector;
import org.springframework.messaging.support.GenericMessage;
@@ -297,13 +297,13 @@ public class RecipientListRouterTests {
assertNotNull(result1a);
assertNotNull(result1b);
assertEquals("test", result1a.getPayload());
assertEquals(0, new EiMessageHeaderAccessor(result1a).getSequenceNumber().intValue());
assertEquals(0, new EiMessageHeaderAccessor(result1a).getSequenceSize().intValue());
assertNull(new EiMessageHeaderAccessor(result1a).getCorrelationId());
assertEquals(0, new IntegrationMessageHeaderAccessor(result1a).getSequenceNumber().intValue());
assertEquals(0, new IntegrationMessageHeaderAccessor(result1a).getSequenceSize().intValue());
assertNull(new IntegrationMessageHeaderAccessor(result1a).getCorrelationId());
assertEquals("test", result1b.getPayload());
assertEquals(0, new EiMessageHeaderAccessor(result1b).getSequenceNumber().intValue());
assertEquals(0, new EiMessageHeaderAccessor(result1b).getSequenceSize().intValue());
assertNull(new EiMessageHeaderAccessor(result1b).getCorrelationId());
assertEquals(0, new IntegrationMessageHeaderAccessor(result1b).getSequenceNumber().intValue());
assertEquals(0, new IntegrationMessageHeaderAccessor(result1b).getSequenceSize().intValue());
assertNull(new IntegrationMessageHeaderAccessor(result1b).getCorrelationId());
}
@Test
@@ -325,13 +325,13 @@ public class RecipientListRouterTests {
assertNotNull(result1a);
assertNotNull(result1b);
assertEquals("test", result1a.getPayload());
assertEquals(1,new EiMessageHeaderAccessor(result1a).getSequenceNumber().intValue());
assertEquals(2, new EiMessageHeaderAccessor(result1a).getSequenceSize().intValue());
assertEquals(message.getHeaders().getId(), new EiMessageHeaderAccessor(result1a).getCorrelationId());
assertEquals(1,new IntegrationMessageHeaderAccessor(result1a).getSequenceNumber().intValue());
assertEquals(2, new IntegrationMessageHeaderAccessor(result1a).getSequenceSize().intValue());
assertEquals(message.getHeaders().getId(), new IntegrationMessageHeaderAccessor(result1a).getCorrelationId());
assertEquals("test", result1b.getPayload());
assertEquals(2, new EiMessageHeaderAccessor(result1b).getSequenceNumber().intValue());
assertEquals(2, new EiMessageHeaderAccessor(result1b).getSequenceSize().intValue());
assertEquals(message.getHeaders().getId(), new EiMessageHeaderAccessor(result1b).getCorrelationId());
assertEquals(2, new IntegrationMessageHeaderAccessor(result1b).getSequenceNumber().intValue());
assertEquals(2, new IntegrationMessageHeaderAccessor(result1b).getSequenceSize().intValue());
assertEquals(message.getHeaders().getId(), new IntegrationMessageHeaderAccessor(result1b).getCorrelationId());
}
@Test(expected = IllegalArgumentException.class)

View File

@@ -33,7 +33,7 @@ import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.annotation.Router;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.integration.router.AbstractMappingMessageRouter;
@@ -188,15 +188,15 @@ public class RouterParserTests {
Message<?> message1 = this.sequenceOut1.receive(1000);
Message<?> message2 = this.sequenceOut2.receive(1000);
Message<?> message3 = this.sequenceOut3.receive(1000);
assertEquals(originalMessage.getHeaders().getId(), new EiMessageHeaderAccessor(message1).getCorrelationId());
assertEquals(originalMessage.getHeaders().getId(), new EiMessageHeaderAccessor(message2).getCorrelationId());
assertEquals(originalMessage.getHeaders().getId(), new EiMessageHeaderAccessor(message3).getCorrelationId());
assertEquals(new Integer(1), new EiMessageHeaderAccessor(message1).getSequenceNumber());
assertEquals(new Integer(3), new EiMessageHeaderAccessor(message1).getSequenceSize());
assertEquals(new Integer(2), new EiMessageHeaderAccessor(message2).getSequenceNumber());
assertEquals(new Integer(3), new EiMessageHeaderAccessor(message2).getSequenceSize());
assertEquals(new Integer(3), new EiMessageHeaderAccessor(message3).getSequenceNumber());
assertEquals(new Integer(3), new EiMessageHeaderAccessor(message3).getSequenceSize());
assertEquals(originalMessage.getHeaders().getId(), new IntegrationMessageHeaderAccessor(message1).getCorrelationId());
assertEquals(originalMessage.getHeaders().getId(), new IntegrationMessageHeaderAccessor(message2).getCorrelationId());
assertEquals(originalMessage.getHeaders().getId(), new IntegrationMessageHeaderAccessor(message3).getCorrelationId());
assertEquals(new Integer(1), new IntegrationMessageHeaderAccessor(message1).getSequenceNumber());
assertEquals(new Integer(3), new IntegrationMessageHeaderAccessor(message1).getSequenceSize());
assertEquals(new Integer(2), new IntegrationMessageHeaderAccessor(message2).getSequenceNumber());
assertEquals(new Integer(3), new IntegrationMessageHeaderAccessor(message2).getSequenceSize());
assertEquals(new Integer(3), new IntegrationMessageHeaderAccessor(message3).getSequenceNumber());
assertEquals(new Integer(3), new IntegrationMessageHeaderAccessor(message3).getSequenceSize());
}
@Test

View File

@@ -21,7 +21,7 @@ import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.messaging.PollableChannel;
import org.springframework.integration.handler.ReplyRequiredException;
@@ -114,8 +114,8 @@ public class SplitterParserTests {
PollableChannel output = (PollableChannel) context.getBean("output");
inputChannel.send(MessageBuilder.withPayload(Collections.emptyList()).build());
Message<?> message = output.receive(1000);
assertThat(new EiMessageHeaderAccessor(message).getSequenceNumber(), is(0));
assertThat(new EiMessageHeaderAccessor(message).getSequenceSize(), is(0));
assertThat(new IntegrationMessageHeaderAccessor(message).getSequenceNumber(), is(0));
assertThat(new IntegrationMessageHeaderAccessor(message).getSequenceSize(), is(0));
}

View File

@@ -29,7 +29,7 @@ import java.util.List;
import org.junit.Test;
import org.springframework.messaging.Message;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.endpoint.EventDrivenConsumer;
@@ -95,7 +95,7 @@ public class DefaultSplitterTests {
endpoint.start();
assertTrue(inputChannel.send(message));
Message<?> reply = outputChannel.receive(0);
assertEquals(message.getHeaders().getId(), new EiMessageHeaderAccessor(reply).getCorrelationId());
assertEquals(message.getHeaders().getId(), new IntegrationMessageHeaderAccessor(reply).getCorrelationId());
}
@Test

View File

@@ -27,7 +27,7 @@ import java.util.List;
import org.junit.Test;
import org.springframework.messaging.Message;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.annotation.Header;
import org.springframework.integration.annotation.Splitter;
import org.springframework.integration.channel.QueueChannel;
@@ -330,14 +330,14 @@ public class MethodInvokingSplitterTests {
List<Message<?>> replies = replyChannel.clear();
Message<?> reply1 = replies.get(0);
assertNotNull(reply1);
assertEquals(new Integer(2), new EiMessageHeaderAccessor(reply1).getSequenceSize());
assertEquals(new Integer(1), new EiMessageHeaderAccessor(reply1).getSequenceNumber());
assertEquals(message.getHeaders().getId(), new EiMessageHeaderAccessor(reply1).getCorrelationId());
assertEquals(new Integer(2), new IntegrationMessageHeaderAccessor(reply1).getSequenceSize());
assertEquals(new Integer(1), new IntegrationMessageHeaderAccessor(reply1).getSequenceNumber());
assertEquals(message.getHeaders().getId(), new IntegrationMessageHeaderAccessor(reply1).getCorrelationId());
Message<?> reply2 = replies.get(1);
assertNotNull(reply2);
assertEquals(new Integer(2), new EiMessageHeaderAccessor(reply2).getSequenceSize());
assertEquals(new Integer(2), new EiMessageHeaderAccessor(reply2).getSequenceNumber());
assertEquals(message.getHeaders().getId(), new EiMessageHeaderAccessor(reply2).getCorrelationId());
assertEquals(new Integer(2), new IntegrationMessageHeaderAccessor(reply2).getSequenceSize());
assertEquals(new Integer(2), new IntegrationMessageHeaderAccessor(reply2).getSequenceNumber());
assertEquals(message.getHeaders().getId(), new IntegrationMessageHeaderAccessor(reply2).getCorrelationId());
}
@Test
@@ -350,14 +350,14 @@ public class MethodInvokingSplitterTests {
List<Message<?>> replies = replyChannel.clear();
Message<?> reply1 = replies.get(0);
assertNotNull(reply1);
assertEquals(new Integer(2), new EiMessageHeaderAccessor(reply1).getSequenceSize());
assertEquals(new Integer(1), new EiMessageHeaderAccessor(reply1).getSequenceNumber());
assertEquals(message.getHeaders().getId(), new EiMessageHeaderAccessor(reply1).getCorrelationId());
assertEquals(new Integer(2), new IntegrationMessageHeaderAccessor(reply1).getSequenceSize());
assertEquals(new Integer(1), new IntegrationMessageHeaderAccessor(reply1).getSequenceNumber());
assertEquals(message.getHeaders().getId(), new IntegrationMessageHeaderAccessor(reply1).getCorrelationId());
Message<?> reply2 = replies.get(1);
assertNotNull(reply2);
assertEquals(new Integer(2), new EiMessageHeaderAccessor(reply2).getSequenceSize());
assertEquals(new Integer(2), new EiMessageHeaderAccessor(reply2).getSequenceNumber());
assertEquals(message.getHeaders().getId(), new EiMessageHeaderAccessor(reply2).getCorrelationId());
assertEquals(new Integer(2), new IntegrationMessageHeaderAccessor(reply2).getSequenceSize());
assertEquals(new Integer(2), new IntegrationMessageHeaderAccessor(reply2).getSequenceNumber());
assertEquals(message.getHeaders().getId(), new IntegrationMessageHeaderAccessor(reply2).getCorrelationId());
}
@Test

View File

@@ -25,7 +25,7 @@ import java.util.UUID;
import org.junit.Test;
import org.springframework.messaging.Message;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.integration.transformer.HeaderFilter;
@@ -71,7 +71,7 @@ public class HeaderFilterTests {
assertNull(result.getHeaders().get("z"));
assertEquals("testErrorChannel", result.getHeaders().getErrorChannel());
assertEquals(replyChannel, result.getHeaders().getReplyChannel());
assertEquals(correlationId, new EiMessageHeaderAccessor(result).getCorrelationId());
assertEquals(correlationId, new IntegrationMessageHeaderAccessor(result).getCorrelationId());
}
}

View File

@@ -788,8 +788,7 @@ public abstract class AbstractRemoteFileOutboundGateway<F> extends AbstractReply
private File generateLocalDirectory(Message<?> message, String remoteDirectory) {
EvaluationContext evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory());
evaluationContext.setVariable("remoteDirectory", remoteDirectory);
// TODO Change 'desiredResultType' as 'File.class' after fix of SPR-10953.
File localDir = new File(this.localDirectoryExpression.getValue(evaluationContext, message, String.class));
File localDir = this.localDirectoryExpression.getValue(evaluationContext, message, File.class);
if (!localDir.exists()) {
Assert.isTrue(localDir.mkdirs(), "Failed to make local directory: " + localDir);
}

View File

@@ -32,7 +32,7 @@ import org.junit.Test;
import org.springframework.core.serializer.DefaultDeserializer;
import org.springframework.core.serializer.DefaultSerializer;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.ip.IpHeaders;
import org.springframework.integration.ip.tcp.serializer.MapJsonSerializer;
import org.springframework.integration.support.MessageBuilder;
@@ -110,7 +110,7 @@ public class TcpMessageMapperTests {
.getHeaders().get(IpHeaders.IP_ADDRESS));
assertEquals(1234, message
.getHeaders().get(IpHeaders.REMOTE_PORT));
assertEquals(Integer.valueOf(0), new EiMessageHeaderAccessor(message).getSequenceNumber());
assertEquals(Integer.valueOf(0), new IntegrationMessageHeaderAccessor(message).getSequenceNumber());
message = mapper.toMessage(connection);
assertEquals(TEST_PAYLOAD, new String((byte[]) message.getPayload()));
assertEquals("MyHost", message
@@ -119,7 +119,7 @@ public class TcpMessageMapperTests {
.getHeaders().get(IpHeaders.IP_ADDRESS));
assertEquals(1234, message
.getHeaders().get(IpHeaders.REMOTE_PORT));
assertEquals(Integer.valueOf(0), new EiMessageHeaderAccessor(message).getSequenceNumber());
assertEquals(Integer.valueOf(0), new IntegrationMessageHeaderAccessor(message).getSequenceNumber());
}
@Test
@@ -172,11 +172,11 @@ public class TcpMessageMapperTests {
.getHeaders().get(IpHeaders.IP_ADDRESS));
assertEquals(1234, message
.getHeaders().get(IpHeaders.REMOTE_PORT));
EiMessageHeaderAccessor headerAccessor = new EiMessageHeaderAccessor(message);
IntegrationMessageHeaderAccessor headerAccessor = new IntegrationMessageHeaderAccessor(message);
assertEquals(Integer.valueOf(1), headerAccessor.getSequenceNumber());
assertEquals(message.getHeaders().get(IpHeaders.CONNECTION_ID), headerAccessor.getCorrelationId());
message = mapper.toMessage(connection);
headerAccessor = new EiMessageHeaderAccessor(message);
headerAccessor = new IntegrationMessageHeaderAccessor(message);
assertEquals(TEST_PAYLOAD, new String((byte[]) message.getPayload()));
assertEquals("MyHost", message
.getHeaders().get(IpHeaders.HOSTNAME));

View File

@@ -43,7 +43,7 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.serializer.Deserializer;
import org.springframework.core.serializer.Serializer;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.history.MessageHistory;
import org.springframework.messaging.support.GenericMessage;
@@ -176,7 +176,7 @@ public class JdbcMessageStoreTests {
message = messageStore.addMessage(message);
message = MessageBuilder.fromMessage(message).setCorrelationId("Y").build();
message = messageStore.addMessage(message);
assertEquals("Y", new EiMessageHeaderAccessor(messageStore.getMessage(message.getHeaders().getId())).getCorrelationId());
assertEquals("Y", new IntegrationMessageHeaderAccessor(messageStore.getMessage(message.getHeaders().getId())).getCorrelationId());
}
@Test
@@ -426,11 +426,11 @@ public class JdbcMessageStoreTests {
assertNotNull(messageFromGroup1);
assertNotNull(messageFromGroup2);
LOG.info("messageFromGroup1: " + messageFromGroup1.getHeaders().getId() + "; Sequence #: " + new EiMessageHeaderAccessor(messageFromGroup1).getSequenceNumber());
LOG.info("messageFromGroup2: " + messageFromGroup2.getHeaders().getId() + "; Sequence #: " + new EiMessageHeaderAccessor(messageFromGroup1).getSequenceNumber());
LOG.info("messageFromGroup1: " + messageFromGroup1.getHeaders().getId() + "; Sequence #: " + new IntegrationMessageHeaderAccessor(messageFromGroup1).getSequenceNumber());
LOG.info("messageFromGroup2: " + messageFromGroup2.getHeaders().getId() + "; Sequence #: " + new IntegrationMessageHeaderAccessor(messageFromGroup1).getSequenceNumber());
assertEquals(Integer.valueOf(1), messageFromGroup1.getHeaders().get(EiMessageHeaderAccessor.SEQUENCE_NUMBER));
assertEquals(Integer.valueOf(2), messageFromGroup2.getHeaders().get(EiMessageHeaderAccessor.SEQUENCE_NUMBER));
assertEquals(Integer.valueOf(1), messageFromGroup1.getHeaders().get(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER));
assertEquals(Integer.valueOf(2), messageFromGroup2.getHeaders().get(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER));
}
@@ -468,11 +468,11 @@ public class JdbcMessageStoreTests {
assertNotNull(messageFromRegion1);
assertNotNull(messageFromRegion2);
LOG.info("messageFromRegion1: " + messageFromRegion1.getHeaders().getId() + "; Sequence #: " + new EiMessageHeaderAccessor(messageFromRegion1).getSequenceNumber());
LOG.info("messageFromRegion2: " + messageFromRegion2.getHeaders().getId() + "; Sequence #: " + new EiMessageHeaderAccessor(messageFromRegion1).getSequenceNumber());
LOG.info("messageFromRegion1: " + messageFromRegion1.getHeaders().getId() + "; Sequence #: " + new IntegrationMessageHeaderAccessor(messageFromRegion1).getSequenceNumber());
LOG.info("messageFromRegion2: " + messageFromRegion2.getHeaders().getId() + "; Sequence #: " + new IntegrationMessageHeaderAccessor(messageFromRegion1).getSequenceNumber());
assertEquals(Integer.valueOf(1), messageFromRegion1.getHeaders().get(EiMessageHeaderAccessor.SEQUENCE_NUMBER));
assertEquals(Integer.valueOf(2), messageFromRegion2.getHeaders().get(EiMessageHeaderAccessor.SEQUENCE_NUMBER));
assertEquals(Integer.valueOf(1), messageFromRegion1.getHeaders().get(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER));
assertEquals(Integer.valueOf(2), messageFromRegion2.getHeaders().get(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER));
}

View File

@@ -38,7 +38,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.jdbc.core.JdbcTemplate;
@@ -150,7 +150,7 @@ public class MySqlJdbcMessageStoreMultipleChannelTests {
public void first(Message<?> message ) {
int sequenceNumber = new EiMessageHeaderAccessor(message).getSequenceNumber();
int sequenceNumber = new IntegrationMessageHeaderAccessor(message).getSequenceNumber();
LOG.info("First handling sequence number: " + sequenceNumber + "; Message ID: " + message.getHeaders().getId());
@@ -163,7 +163,7 @@ public class MySqlJdbcMessageStoreMultipleChannelTests {
public void second(Message<?> message ) {
int sequenceNumber = new EiMessageHeaderAccessor(message).getSequenceNumber();
int sequenceNumber = new IntegrationMessageHeaderAccessor(message).getSequenceNumber();
LOG.info("Second handling sequence number: " + sequenceNumber + "; Message ID: " + message.getHeaders().getId());
if (sequenceNumber != 2) {

View File

@@ -45,7 +45,7 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.serializer.Deserializer;
import org.springframework.core.serializer.Serializer;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.history.MessageHistory;
import org.springframework.integration.jdbc.JdbcMessageStore;
@@ -215,7 +215,7 @@ public class MySqlJdbcMessageStoreTests {
message = messageStore.addMessage(message);
message = MessageBuilder.fromMessage(message).setCorrelationId("Y").build();
message = messageStore.addMessage(message);
assertEquals("Y", new EiMessageHeaderAccessor(messageStore.getMessage(message.getHeaders().getId())).getCorrelationId());
assertEquals("Y", new IntegrationMessageHeaderAccessor(messageStore.getMessage(message.getHeaders().getId())).getCorrelationId());
}
@Test
@@ -466,11 +466,11 @@ public class MySqlJdbcMessageStoreTests {
assertNotNull(messageFromGroup1);
assertNotNull(messageFromGroup2);
LOG.info("messageFromGroup1: " + messageFromGroup1.getHeaders().getId() + "; Sequence #: " + new EiMessageHeaderAccessor(messageFromGroup1).getSequenceNumber());
LOG.info("messageFromGroup2: " + messageFromGroup2.getHeaders().getId() + "; Sequence #: " + new EiMessageHeaderAccessor(messageFromGroup2).getSequenceNumber());
LOG.info("messageFromGroup1: " + messageFromGroup1.getHeaders().getId() + "; Sequence #: " + new IntegrationMessageHeaderAccessor(messageFromGroup1).getSequenceNumber());
LOG.info("messageFromGroup2: " + messageFromGroup2.getHeaders().getId() + "; Sequence #: " + new IntegrationMessageHeaderAccessor(messageFromGroup2).getSequenceNumber());
assertEquals(Integer.valueOf(1), (Integer) messageFromGroup1.getHeaders().get(EiMessageHeaderAccessor.SEQUENCE_NUMBER));
assertEquals(Integer.valueOf(2), (Integer) messageFromGroup2.getHeaders().get(EiMessageHeaderAccessor.SEQUENCE_NUMBER));
assertEquals(Integer.valueOf(1), (Integer) messageFromGroup1.getHeaders().get(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER));
assertEquals(Integer.valueOf(2), (Integer) messageFromGroup2.getHeaders().get(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER));
}
@@ -510,11 +510,11 @@ public class MySqlJdbcMessageStoreTests {
assertNotNull(messageFromRegion1);
assertNotNull(messageFromRegion2);
LOG.info("messageFromRegion1: " + messageFromRegion1.getHeaders().getId() + "; Sequence #: " + new EiMessageHeaderAccessor(messageFromRegion1).getSequenceNumber());
LOG.info("messageFromRegion2: " + messageFromRegion2.getHeaders().getId() + "; Sequence #: " +new EiMessageHeaderAccessor(messageFromRegion2).getSequenceNumber());
LOG.info("messageFromRegion1: " + messageFromRegion1.getHeaders().getId() + "; Sequence #: " + new IntegrationMessageHeaderAccessor(messageFromRegion1).getSequenceNumber());
LOG.info("messageFromRegion2: " + messageFromRegion2.getHeaders().getId() + "; Sequence #: " +new IntegrationMessageHeaderAccessor(messageFromRegion2).getSequenceNumber());
assertEquals(Integer.valueOf(1), (Integer) messageFromRegion1.getHeaders().get(EiMessageHeaderAccessor.SEQUENCE_NUMBER));
assertEquals(Integer.valueOf(2), (Integer) messageFromRegion2.getHeaders().get(EiMessageHeaderAccessor.SEQUENCE_NUMBER));
assertEquals(Integer.valueOf(1), (Integer) messageFromRegion1.getHeaders().get(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER));
assertEquals(Integer.valueOf(2), (Integer) messageFromRegion2.getHeaders().get(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER));
}
}

View File

@@ -17,7 +17,7 @@
package org.springframework.integration.jms;
import org.springframework.messaging.Message;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.channel.AbstractMessageChannel;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.util.Assert;
@@ -45,7 +45,7 @@ public abstract class AbstractJmsChannel extends AbstractMessageChannel {
@Override
protected boolean doSend(Message<?> message, long timeout) {
try {
DynamicJmsTemplateProperties.setPriority(new EiMessageHeaderAccessor(message).getPriority());
DynamicJmsTemplateProperties.setPriority(new IntegrationMessageHeaderAccessor(message).getPriority());
this.jmsTemplate.convertAndSend(message);
}
finally {

View File

@@ -44,7 +44,7 @@ import javax.jms.Topic;
import org.springframework.context.SmartLifecycle;
import org.springframework.expression.Expression;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.MessageHandlingException;
import org.springframework.integration.MessageTimeoutException;
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
@@ -668,7 +668,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp
jmsRequest.setJMSReplyTo(replyTo);
connection.start();
Integer priority = new EiMessageHeaderAccessor(requestMessage).getPriority();
Integer priority = new IntegrationMessageHeaderAccessor(requestMessage).getPriority();
if (priority == null) {
priority = this.priority;
}
@@ -722,7 +722,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp
jmsRequest.setJMSReplyTo(replyTo);
connection.start();
Integer priority = new EiMessageHeaderAccessor(requestMessage).getPriority();
Integer priority = new IntegrationMessageHeaderAccessor(requestMessage).getPriority();
if (priority == null) {
priority = this.priority;
}

View File

@@ -20,7 +20,7 @@ import javax.jms.Destination;
import javax.jms.JMSException;
import org.springframework.expression.Expression;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.integration.handler.AbstractMessageHandler;
import org.springframework.integration.handler.ExpressionEvaluatingMessageProcessor;
import org.springframework.jms.core.JmsTemplate;
@@ -109,7 +109,7 @@ public class JmsSendingMessageHandler extends AbstractMessageHandler {
Object objectToSend = (this.extractPayload) ? message.getPayload() : message;
MessagePostProcessor messagePostProcessor = new HeaderMappingMessagePostProcessor(message, this.headerMapper);
try {
DynamicJmsTemplateProperties.setPriority(new EiMessageHeaderAccessor(message).getPriority());
DynamicJmsTemplateProperties.setPriority(new IntegrationMessageHeaderAccessor(message).getPriority());
this.send(destination, objectToSend, messagePostProcessor);
}
finally {

View File

@@ -25,7 +25,7 @@ import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.junit.Assert;
import org.springframework.integration.EiMessageHeaderAccessor;
import org.springframework.integration.IntegrationMessageHeaderAccessor;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHeaders;
@@ -127,7 +127,7 @@ public class HeaderMatcher extends TypeSafeMatcher<Message<?>> {
@Factory
public static <T> Matcher<Message<?>> hasCorrelationId(T value) {
return new HeaderMatcher(MapContentMatchers.hasEntry(EiMessageHeaderAccessor.CORRELATION_ID, value));
return new HeaderMatcher(MapContentMatchers.hasEntry(IntegrationMessageHeaderAccessor.CORRELATION_ID, value));
}
@Factory
@@ -137,7 +137,7 @@ public class HeaderMatcher extends TypeSafeMatcher<Message<?>> {
@Factory
public static Matcher<Message<?>> hasSequenceNumber(Matcher<Integer> matcher) {
return new HeaderMatcher(MapContentMatchers.hasEntry(EiMessageHeaderAccessor.SEQUENCE_NUMBER, matcher));
return new HeaderMatcher(MapContentMatchers.hasEntry(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, matcher));
}
@Factory
@@ -147,7 +147,7 @@ public class HeaderMatcher extends TypeSafeMatcher<Message<?>> {
@Factory
public static Matcher<Message<?>> hasSequenceSize(Matcher<Integer> value) {
return new HeaderMatcher(MapContentMatchers.hasEntry(EiMessageHeaderAccessor.SEQUENCE_SIZE, value));
return new HeaderMatcher(MapContentMatchers.hasEntry(IntegrationMessageHeaderAccessor.SEQUENCE_SIZE, value));
}
@Factory
@@ -157,7 +157,7 @@ public class HeaderMatcher extends TypeSafeMatcher<Message<?>> {
@Factory
public static Matcher<Message<?>> hasExpirationDate(Matcher<Long> matcher) {
return new HeaderMatcher(MapContentMatchers.hasEntry(EiMessageHeaderAccessor.EXPIRATION_DATE, matcher));
return new HeaderMatcher(MapContentMatchers.hasEntry(IntegrationMessageHeaderAccessor.EXPIRATION_DATE, matcher));
}
@Factory

View File

@@ -1,9 +1,676 @@
<?xml version="1.0" encoding="UTF-8"?>
<section xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="migration-2.2-3.0"
xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Changes between 2.2 and 3.0</title>
<para>
For an overview of the changes in Spring Integration 3.0 since version 2.2,
please see <xref linkend="whats-new"/>.
</para>
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Changes Between 2.2 and 3.0</title>
<section id="3.0-new-components">
<title>New Components</title>
<section id="3.0-request-mapping">
<title>HTTP Request Mapping</title>
<para>
The HTTP module now provides powerful Request Mapping support for Inbound Endpoints. Class <classname>UriPathHandlerMapping</classname>
was replaced by <classname>IntegrationRequestMappingHandlerMapping</classname>, which is registered under the bean name
<code>integrationRequestMappingHandlerMapping</code> in the application context. Upon parsing of the HTTP Inbound Endpoint,
a new <classname>IntegrationRequestMappingHandlerMapping</classname> bean is either registered or an existing bean is being reused.
To achieve flexible Request Mapping configuration, Spring Integration provides the <code>&lt;request-mapping/&gt;</code>
sub-element for the <code>&lt;http:inbound-channel-adapter/&gt;</code> and the <code>&lt;http:inbound-gateway/&gt;</code>.
Both HTTP Inbound Endpoints are now fully based on the Request Mapping infrastructure that was introduced with Spring MVC 3.1.
For example, multiple paths are supported on a single inbound endpoint.
For more information see <xref linkend="http-namespace"/>.
</para>
</section>
<section id="3.0-spel-customization">
<title>Spring Expression Language (SpEL) Configuration</title>
<para>
A new <classname>IntegrationEvaluationContextFactoryBean</classname> is provided to allow
configuration of custom <interfacename>PropertyAccessor</interfacename>s and functions for
use in SpEL expressions throughout the framework. For more information see <xref linkend="spel" />.
</para>
</section>
<section id="3.0-spel-functions">
<title>SpEL Functions Support</title>
<para>
To customize the SpEL <interfacename>EvaluationContext</interfacename> with static
<classname>Method</classname> functions, the new <code>&lt;spel-function/&gt;</code>
component is introduced. Two built-in functions are also provided (<code>#jsonPath</code>
and <code>#xpath</code>). For more information see <xref linkend="spel-functions" />.
</para>
</section>
<section id="3.0-spel-property-accessors">
<title>SpEL PropertyAccessors Support</title>
<para>
To customize the SpEL <interfacename>EvaluationContext</interfacename> with
<interfacename>PropertyAccessor</interfacename> implementations
the new <code>&lt;spel-property-accessors/&gt;</code> component is introduced.
For more information see <xref linkend="spel-property-accessors" />.
</para>
</section>
<section id="3.0-redis-new-components">
<title>Redis: New Components</title>
<para>
A new Redis-based
<interfacename><ulink url="http://docs.spring.io/spring-integration/docs/latest-ga/api/org/springframework/integration/store/MetadataStore.html">MetadataStore</ulink></interfacename>
implementation has been added. The <classname>RedisMetadataStore</classname> can
be used to maintain state of a <interfacename>MetadataStore</interfacename>
across application restarts. This new <interfacename>MetadataStore</interfacename>
implementation can be used with adapters such as:
</para>
<itemizedlist>
<listitem>Twitter Inbound Adapters</listitem>
<listitem>Feed Inbound Channel Adapter</listitem>
</itemizedlist>
<para>
New queue-based components have been added. The <code>&lt;int-redis:queue-inbound-channel-adapter/&gt;</code>
and the <code>&lt;int-redis:queue-outbound-channel-adapter/&gt;</code> components are provided
to perform 'right pop' and 'left push' operations on a Redis List, respectively.
</para>
<para>
For more information see <xref linkend="redis" />.
</para>
</section>
<section id="3.0-hcr">
<title>Header Channel Registry</title>
<para>
It is now possible to instruct the framework to store reply and error channels
in a registry for later resolution. This is useful for cases where
the <code>replyChannel</code> or <code>errorChannel</code> might be lost; for example
when serializing
a message. See <xref linkend="header-enricher"/> for more information.
</para>
</section>
<section id="3.0-configurable-mongo-MS">
<title>MongoDB support: New ConfigurableMongoDbMessageStore</title>
<para>
In addition to the existing <classname>eMongoDbMessageStore</classname>, a new
<classname>ConfigurableMongoDbMessageStore</classname> has been introduced.
This provides a more robust and flexible implementation of <interfacename>MessageStore</interfacename>
for MongoDB.
It does not have backward compatibility, with the existing store,
but it is recommended to use it for new applications. Existing applications can use it, but messages
in the old store will not be available.
See <xref linkend="mongodb"/> for more information.
</para>
</section>
<section id="3.0-syslog">
<title>Syslog Support</title>
<para>
Building on the 2.2 <classname>SyslogToMapTransformer</classname> Spring
Integration 3.0 now introduces
<code>UDP</code> and <code>TCP</code> inbound channel adapters especially tailored
for receiving SYSLOG messages. For more information, see
<xref linkend="syslog"/>.
</para>
</section>
<section id="3.0-tail">
<title>'Tail' Support</title>
<para>
File 'tail'ing inbound channel adapters are now provided to generate messages when
lines are added to the end of text files; see <xref linkend="file-tailing"/>.
</para>
</section>
<section id="3.0-jmx">
<title>JMX Support</title>
<para>
<itemizedlist>
<listitem>
A new <code>&lt;int-jmx:tree-polling-channel-adapter/&gt;</code> is provided; this
adapter queries the JMX MBean tree and sends a message with a payload that is the
graph of objects that matches the query. By default the MBeans are mapped to
primitives and simple Objects like Map, List and arrays - permitting simple
transformation, for example, to JSON.
</listitem>
<listitem>
The <classname>IntegrationMBeanExporter</classname> now allows the configuration of
a custom <classname>ObjectNamingStrategy</classname> using the <code>naming-strategy</code>
attribute.
</listitem>
</itemizedlist>
</para>
<para>
For more information, see <xref linkend="jmx"/>.
</para>
</section>
<section id="3.0-tcp-events">
<title>TCP/IP Connection Events and Connection Management</title>
<para>
<classname>TcpConnection</classname>s now emit
<interfacename>ApplicationEvent</interfacename>s (specifically
<classname>TcpConnectionEvent</classname>s) when connections are
opened, closed, or an exception occurs. This allows applications
to be informed of changes to TCP connections using the normal
Spring <interfacename>ApplicationListener</interfacename>
mechanism.
</para>
<para>
<classname>AbstractTcpConnection</classname> has been renamed
<classname>TcpConnectionSupport</classname>; custom connections that
are subclasses of this class, can use its methods to publish events.
Similarly, <classname>AbstractTcpConnectionInterceptor</classname> has
been renamed to <classname>TcpConnectionInterceptorSupport</classname>.
</para>
<para>
In addition, a new <code>&lt;int-ip:tcp-connection-event-inbound-channel-adapter/&gt;</code>
is provided; by default, this adapter sends all <classname>TcpConnectionEvent</classname>s
to a <interfacename>Channel</interfacename>.
</para>
<para>
Further, the TCP Connection Factories, now provide a new method
<code>getOpenConnectionIds()</code>, which returns a list of identifiers for all
open connections; this allows applications, for example, to broadcast to all
open connections.
</para>
<para>
Finally, the connection factories also provide a new method
<code>closeConnection(String connectionId)</code> which allows applications
to explicitly close a connection using its ID.
</para>
<para>
For more information see <xref linkend="tcp-events"/>.
</para>
</section>
<section id="3.0-inbound-script">
<title>Inbound Channel Adapter Script Support</title>
<para>
The <code>&lt;int:inbound-channel-adapter/&gt;</code> now supports <code>&lt;expression/&gt;</code>
and <code>&lt;script/&gt;</code> sub-elements to create a
<interfacename>MessageSource</interfacename>; see <xref linkend="channel-adapter-expressions-and-scripts"/>.
</para>
</section>
<section id="3.0-content-enricher-headers">
<title>Content Enricher: Headers Enrichment Support</title>
<para>
The Content Enricher now provides configuration for <code>&lt;header/&gt;</code>
sub-elements, to enrich the outbound Message with headers based on the reply Message from the underlying
message flow. For more information see <xref linkend="payload-enricher"/>.
</para>
</section>
</section>
<section id="3.0-general">
<title>General Changes</title>
<section id="3.0-message-id">
<title>Message ID Generation</title>
<para>
Previously, message ids were generated using the JDK <code>UUID.randomUUID()</code> method. With this
release, the default mechanism has been changed to use a more efficient algorithm which
is significantly faster. In addition, the ability to change
the strategy used to generate message ids has been added.
For more information see <xref linkend="message-id-generation"/>.
</para>
</section>
<section id="3.0-gateway">
<title>&lt;gateway&gt; Changes</title>
<para>
<itemizedlist>
<listitem>
It is now possible to set common headers across all gateway methods, and more options
are provided for adding, to the message, information about which method was invoked.
</listitem>
<listitem>
It is now possible to entirely customize the way that gateway method calls are mapped
to messages.
</listitem>
<listitem>
The <classname>GatewayMethodMetadata</classname> is now public class and it makes possible flexibly
to configure the <classname>GatewayProxyFactoryBean</classname> programmatically from Java code.
</listitem>
</itemizedlist>
</para>
<para>
For more information see <xref linkend="gateway"/>.
</para>
</section>
<section id="3.0-http-endpointss">
<title>HTTP Endpoint Changes</title>
<para>
<itemizedlist>
<listitem>
<emphasis role="bold">Outbound Endpoint 'encode-uri'</emphasis> - <code>&lt;http:outbound-gateway/&gt;</code>
and <code>&lt;http:outbound-channel-adapter/&gt;</code> now
provide an <code>encode-uri</code> attribute to allow disabling the encoding of the URI object
before sending the request.
</listitem>
<listitem>
<emphasis role="bold">Inbound Endpoint 'merge-with-default-converters'</emphasis> -
<code>&lt;http:inbound-gateway/&gt;</code> and <code>&lt;http:inbound-channel-adapter/&gt;</code> now
have a <code>merge-with-default-converters</code> attribute to include the list of default
<interfacename>HttpMessageConverter</interfacename>s after the custom message converters.
</listitem>
<listitem>
<emphasis role="bold">'If-(Un)Modified-Since' HTTP Headers</emphasis> - previously,
'If-Modified-Since' and 'If-Unmodified-Since' HTTP headers were incorrectly processed
within from/to HTTP headers mapping in the <classname>DefaultHttpHeaderMapper</classname>.
Now, in addition correcting that issue, <classname>DefaultHttpHeaderMapper</classname> provides
date parsing from formatted strings for any HTTP headers that accept date-time values.
</listitem>
<listitem>
<emphasis role="bold">Inbound Endpoint Expression Variables</emphasis> -
In addition to the existing <emphasis>#requestParams</emphasis> and <emphasis>#pathVariables</emphasis>,
the <code>&lt;http:inbound-gateway/&gt;</code> and <code>&lt;http:inbound-channel-adapter/&gt;</code>
now support additional useful variables: <emphasis>#matrixVariables</emphasis>, <emphasis>#requestAttributes</emphasis>,
<emphasis>#requestHeaders</emphasis> and <emphasis>#cookies</emphasis>. These variables are available in
both payload and header expressions.
</listitem>
<listitem>
<emphasis role="bold">Outbound Endpoint 'uri-variables-expression'</emphasis> - HTTP Outbound Endpoints
now support the <code>uri-variables-expression</code> attribute to specify
an <interfacename>Expression</interfacename> to evaluate a <interfacename>Map</interfacename>
for all URI variable placeholders within URL template. This allows selection of a different
map of expressions based on the outgoing message.
</listitem>
</itemizedlist>
</para>
<para>
For more information see <xref linkend="http"/>.
</para>
</section>
<section id="3.0-json-transformers">
<title>Jackson Support (JSON)</title>
<para>
<itemizedlist>
<listitem>
A new abstraction for JSON conversion has been introduced. Implementations for Jackson 1.x
and Jackson 2 are currently provided, with the version being determined by presence on
the classpath. Previously, only Jackson 1.x was supported.
</listitem>
<listitem>
The <classname>ObjectToJsonTransformer</classname> and <classname>JsonToObjectTransformer</classname>
now emit/consume headers containing type information.
</listitem>
</itemizedlist>
</para>
<para>
For more information, see 'JSON Transformers' in <xref linkend="transformer"/>.
</para>
</section>
<section id="3.0-id-for-chain-sub-components">
<title>Chain Elements 'id' Attribute</title>
<para>
Previously, the <emphasis>id</emphasis> attribute for elements within a <code>&lt;chain&gt;</code> was
ignored and, in some cases, disallowed. Now, the <emphasis>id</emphasis> attribute is allowed
for all elements within a <code>&lt;chain&gt;</code>. The bean names of chain elements is a combination
of the surrounding chain's <emphasis>id</emphasis> and the <emphasis>id</emphasis> of the element
itself. For example: 'fooChain$child.fooTransformer.handler'.
For more information see <xref linkend="chain"/>.
</para>
</section>
<section id="3.0-corr-endpoint-empty-groups">
<title>Aggregator 'empty-group-min-timeout' property</title>
<para>
The <classname>AbstractCorrelatingMessageHandler</classname> provides a new property
<code>empty-group-min-timeout</code>
to allow empty group expiry to run on a longer schedule than expiring partial groups. Empty groups will
not be removed from the <interfacename>MessageStore</interfacename> until they have not been modified
for at least this number of milliseconds. For more information see <xref linkend="aggregator-config"/>.
</para>
</section>
<section id="3.0-filelistfilter">
<title>Persistent File List Filters (file, (S)FTP)</title>
<para>
New <classname>FileListFilter</classname>s that use a persistent <classname>MetadataStore</classname> are
now available. These can be used to prevent duplicate files after a system restart. See
<xref linkend="file-reading"/>, <xref linkend="ftp-inbound"/>, and <xref linkend="sftp-inbound"/> for more information.
</para>
</section>
<section id="3.0-scripting-variables">
<title>Scripting Support: Variables Changes</title>
<para>
A new <code>variables</code> attribute has been introduced for scripting components.
In addition, variable bindings are now allowed for inline scripts.
See <xref linkend="groovy"/> and <xref linkend="scripting"/> for more information.
</para>
</section>
<section id="3.0-direct-channel-lb-ref">
<title>Direct Channel Load Balancing configuration</title>
<para>
Previously, when configuring <classname>LoadBalancingStrategy</classname> on the channel's 'dispatcher' sub-element,
the only available option was to use a pre-defined enumeration of values which did not allow one to set a custom implementation
of the <classname>LoadBalancingStrategy</classname>. You can now use <code>load-balancer-ref</code> to provide
a reference to a custom implementation of the <classname>LoadBalancingStrategy</classname>.
For more information see <xref linkend="channel-implementations-directchannel"/>.
</para>
</section>
<section id="3.0-pub-sub">
<title>PublishSubscribeChannel Behavior</title>
<para>
Previously, sending to a &lt;publish-subscribe-channel/&gt; that had
no subscribers would return a <code>false</code> result. If used in conjunction with
a <classname>MessagingTemplate</classname>, this would result in an exception being thrown.
Now, the <classname>PublishSubscribeChannel</classname> has a property
<code>minSubscribers</code> (default 0). If the message is sent to at least the minimum
number of subscribers, the send is deemed to be successful (even if zero). If an application
is expecting to get an exception under these conditions, set the minimum subscribers to at
least 1.
</para>
</section>
<section id="3.0-(s)ftp-changes">
<title>FTP, SFTP and FTPS Changes</title>
<para>
<emphasis role="bold">The FTP, SFTP and FTPS endpoints no longer cache sessions by default</emphasis>
</para>
<para>
The deprecated <code>cached-sessions</code> attribute has been removed from all endpoints.
Previously, the embedded caching mechanism controlled by this attribute's value didn't
provide a way to limit the size of the cache, which could
grow indefinitely. The <classname>CachingConnectionFactory</classname> was introduced in
release 2.1 and it became the preferred (and is now the only) way to cache sessions.
</para>
<para>
The <classname>CachingConnectionFactory</classname> now provides a new method
<code>resetCache()</code>. This immediately closes idle sessions and causes in-use
sessions to be closed as and when they are returned to the cache.
</para>
<para>
The <classname>DefaultSftpSessionFactory</classname> (in conjunction with a
<classname>CachingSessionFactory</classname>) now supports multiplexing channels over
a single SSH connection (SFTP Only).
</para>
<para>
<emphasis role="bold">FTP, SFTP and FTPS Inbound Adapters</emphasis>
</para>
<para>
Previously, there was no way to override the default filter used to process files retrieved
from a remote server. The <code>filter</code> attribute determines which files are retrieved
but the <classname>FileReadingMessageSource</classname> uses an
<classname>AcceptOnceFileListFilter</classname>. This means that if a new copy of a file
is retrieved, with the same name as a previously copied file, no message was sent from the
adapter.
</para>
<para>
With this release, a new attribute <code>local-filter</code> allows you to override the
default filter, for example with an <classname>AcceptAllFileListFilter</classname>, or some
other custom filter.
</para>
<para>
For users that wish the behavior of the <classname>AcceptOnceFileListFilter</classname>
to be maintained across JVM executions, a custom filter that retains state, perhaps on
the file system, can now be configured.
</para>
<para>
Inbound Channel Adapters now support the <code>preserve-timestamp</code> attribute, which
sets the local file modified timestamp to the timestamp from the server (default false).
</para>
<para>
<emphasis role="bold">FTP, SFTP and FTPS Gateways</emphasis>
</para>
<para>
<itemizedlist>
<listitem>
The gateways now support the <emphasis role="bold">mv</emphasis> command, enabling
the renaming of remote files.
</listitem>
<listitem>
The gateways now support recursive <emphasis role="bold">ls</emphasis> and
<emphasis role="bold">mget</emphasis> commands, enabling
the retrieval of a remote file tree.
</listitem>
<listitem>
The gateways now support <emphasis role="bold">put</emphasis> and
<emphasis role="bold">mput</emphasis> commands, enabling
sending file(s) to the remote server.
</listitem>
<listitem>
The <code>local-filename-generator-expression</code> attribute is now supported,
enabling the naming of local files during retrieval. By default, the same
name as the remote file is used.
</listitem>
<listitem>
The <code>local-directory-expression</code> attribute is now supported,
enabling the naming of local directories during retrieval based on the remote directory.
</listitem>
</itemizedlist>
</para>
<para>
<emphasis role="bold">Remote File Template</emphasis>
</para>
<para>
A new higher-level abstraction (<classname>RemoteFileTemplate</classname>) is provided over the
<interfacename>Session</interfacename> implementations used by the FTP and SFTP modules. While it is
used internally by endpoints, this abstraction can also be used programmatically and, like all
Spring <code>*Template</code> implementations, reliably closes the underlying session while allowing
low level access to the session when needed.
</para>
<para>
For more information, see
<xref linkend="ftp"/> and <xref linkend="sftp"/>.
</para>
</section>
<section id="3.0-outbound-gateway-requires-reply">
<title>'requires-reply' Attribute for Outbound Gateways</title>
<para>
All Outbound Gateways (e.g. <code>&lt;jdbc:outbound-gateway/&gt;</code> or <code>&lt;jms:outbound-gateway/&gt;</code>)
are designed for 'request-reply' scenarios. A response is expected from the external service and
will be published to the <code>reply-channel</code>, or the <code>replyChannel</code> message header.
However, there are some cases where the external system might not always return a
result, e.g. a <code>&lt;jdbc:outbound-gateway/&gt;</code>, when a SELECT ends with an empty <interfacename>ResultSet</interfacename>
or, say, a Web Service is One-Way. An option is therefore needed to configure whether or not a
<emphasis>reply</emphasis> is required.
For this purpose, the <emphasis>requires-reply</emphasis> attribute has been introduced for Outbound Gateway components.
In most cases, the default value for <emphasis>requires-reply</emphasis> is <code>true</code> and, if there is not any result,
a <classname>ReplyRequiredException</classname> will be thrown. Changing the value to <code>false</code>
means that, if an external service doesn't return anything, the message-flow will end at that point,
similar to an Outbound Channel Adapter.
</para>
<note>
The WebService outbound gateway has an additional attribute <code>ignore-empty-responses</code>; this is used to
treat an empty String response as if no response was received. It is true by default but can be set to false to
allow the application to receive an empty String in the reply message payload. When the attribute is true an empty
string is treated as no response for the purposes of the <emphasis>requires-reply</emphasis> attribute.
<emphasis>requires-reply</emphasis> is false by default for the WebService outbound gateway.
</note>
<para>
Note, the <code>requiresReply</code> property was previously present in the <classname>AbstractReplyProducingMessageHandler</classname>
but set to <code>false</code>, and there wasn't any way to configure it on Outbound Gateways using the XML namespace.
</para>
<important>
Previously, a gateway receiving no reply would silently end the flow (with a DEBUG log message); with this change an
exception will now be thrown by default by most gateways. To revert to the previous behavior,
set <code>requires-reply</code> to false.
</important>
</section>
<section id="3.0-amqp-mapping">
<title>AMQP Outbound Gateway Header Mapping</title>
<para>
Previously, the &lt;int-amqp:outbound-gateway/&gt; mapped headers before invoking the message
converter, and the converter could overwrite headers such as <code>content-type</code>. The
outbound adapter maps the headers after the conversion, which means headers like
<code>content-type</code> from the outbound <code>Message</code> (if present) are used.
</para>
<para>
Starting with this release, the gateway now maps the headers after the message conversion,
consistent with the adapter. If your application relies on the previous behavior (where the
converter's headers overrode the mapped headers), you either need to filter those headers
(before the message reaches the gateway)
or set them appropriately. The headers affected by the <classname>SimpleMessageConverter</classname>
are <code>content-type</code> and <code>content-encoding</code>. Custom message converters
may set other headers.
</para>
</section>
<section id="3.0-stored-proc-sql-return-type">
<title>Stored Procedure Components Improvements</title>
<para>
For more complex database-specific types, not supported by the standard
<code>CallableStatement.getObject</code> method, 2 new additional
attributes were introduced to the <code>&lt;sql-parameter-definition/&gt;</code>
element with OUT-direction:
</para>
<itemizedlist>
<listitem><emphasis>type-name</emphasis></listitem>
<listitem><emphasis>return-type</emphasis></listitem>
</itemizedlist>
<para>
<para>
The <code>row-mapper</code> attribute of the Stored Procedure Inbound Channel Adapter
<code>&lt;returning-resultset/&gt;</code> sub-element
now supports a reference to a <interfacename>RowMapper</interfacename> bean
definition. Previously, it contained just a class name (which is still supported).
</para>
<para>
For more information see <xref linkend="stored-procedures"/>.
</para>
</para>
</section>
<section id="3.0-ws-outbound-uri-substitution">
<title>Web Service Outbound URI Configuration</title>
<para>
Web Service Outbound Gateway 'uri' attribute now supports <code>&lt;uri-variable/&gt;</code> substitution for all
URI-schemes supported by Spring Web Services. For more information see <xref linkend="outbound-uri"/>.
</para>
</section>
<section id="3.0-redis">
<title>Redis Adapter Changes</title>
<para>
<itemizedlist>
<listitem>
The Redis Inbound Channel Adapter can now use a <code>null</code> value for <code>serializer</code>
property, with the raw data being the message payload.
</listitem>
<listitem>
The Redis Outbound Channel Adapter now has the <code>topic-expression</code> property to determine
the Redis topic against the Message at runtime.
</listitem>
<listitem>
The Redis Inbound Channel Adapter, in addition to the existing <code>topics</code> attribute,
now has the <code>topic-patterns</code> attribute.
</listitem>
</itemizedlist>
</para>
<para>
For more information, see <xref linkend="redis"/>.
</para>
</section>
<section id="3.0-advising-filters">
<title>Advising Filters</title>
<para>
Previously, when a &lt;filter/&gt; had a &lt;request-handler-advice-chain/&gt;, the discard
action was all performed within the scope of the advice chain (including any downstream flow
on the <code>discard-channel</code>). The filter element now has an attribute
<code>discard-within-advice</code> (default <code>true</code>), to allow the discard action to
be performed after the advice chain completes. See <xref linkend="advising-filters"/>.
</para>
</section>
<section id="3.0-annotation-advice">
<title>Advising Endpoints using Annotations</title>
<para>
Request Handler Advice Chains can now be configured using annotations. See
<xref linkend="advising-with-annotations"/>.
</para>
</section>
<section id="3.0-o-t-s-t">
<title>ObjectToStringTransformer Improvements</title>
<para>
This transformer now correctly transforms <code>byte[]</code> and <code>char[]</code>
payloads to <classname>String</classname>. For more information see <xref linkend="transformer"/>.
</para>
</section>
<section id="3.0-jpa-changes">
<title>JPA Support Changes</title>
<para>
Payloads to <emphasis>persist</emphasis> or
<emphasis>merge</emphasis> can now be of type
<interfacename><ulink url="http://docs.oracle.com/javase/7/docs/api/java/lang/Iterable.html"
>java.lang.Iterable</ulink></interfacename>.
</para>
<para>
In that case, each object returned by the
<interfacename>Iterable</interfacename> is treated as
an entity and persisted or merged using the underlying
<interfacename>EntityManager</interfacename>.
<emphasis>NULL</emphasis> values returned by the iterator are ignored.
</para>
<para>
The JPA adapters now have additional attributes to optionally 'flush' and 'clear'
entities from the associated persistence context after performing persistence operations.
</para>
<para>
Retrieving gateways had no mechanism to specify the first record to be retrieved which
is a common use case. The retrieving gateways now support specifying this parameter
using a <code>first-result</code> and <code>first-result-expression</code> attributes
to the gateway definition. <xref linkend="jpa-retrieving-outbound-gateway"/>.
</para>
<para>
The JPA retrieving gateway and inbound adapter now have an attribute to specify the maximum
number of results in a result set as an expression. In addition, the
<code>max-results</code> attribute has been introduced to replace
<code>max-number-of-results</code>, which has been deprecated.
<code>max-results</code> and <code>max-results-expression</code>
are used to provide the maximum number of results,
or an expression to compute the maximum number of results, respectively, in the
result set.
</para>
<para>For more information see <xref linkend="jpa"/>.</para>
</section>
<section id="3.0-dalay-expression">
<title>Delayer: delay expression</title>
<para>
Previously, the <code>&lt;delayer&gt;</code> provided a <code>delay-header-name</code> attribute
to determine the <emphasis>delay</emphasis> value at runtime. In complex cases it was necessary
to precede the <code>&lt;delayer&gt;</code> with a <code>&lt;header-enricher&gt;</code>.
Spring Integration 3.0 introduced the <code>expression</code> attribute and <code>expression</code>
sub-element for dynamic delay determination. The <code>delay-header-name</code> attribute is now deprecated
because the header evaluation can be specified in the <code>expression</code>. In addition,
the <code>ignore-expression-failures</code> was introduced to control the behavior when an
expression evaluation fails.
For more information see <xref linkend="delayer"/>.
</para>
</section>
<section id="3.0-jdbc-mysql-v5_6_4">
<title>JDBC Message Store Improvements</title>
<para>
<emphasis>Spring Integration 3.0</emphasis> adds a new set of DDL
scripts for <emphasis>MySQL</emphasis> version 5.6.4 and higher.
Now <emphasis>MySQL</emphasis> supports <emphasis>fractional
seconds</emphasis> and is thus improving the FIFO ordering when
polling from a MySQL-based Message Store. For more information,
please see <xref linkend="jdbc-message-store-generic"/>.
</para>
</section>
<section id="3.0-event-for-imap-idle">
<title>IMAP Idle Connection Exceptions</title>
<para>
Previously, if an IMAP idle connection failed, it was logged but there was no mechanism to
inform an application. Such exceptions now generate <classname>ApplicationEvent</classname>s.
Applications can obtain these events using an <code>&lt;int-event:inbound-channel-adapter&gt;</code>
or any <interfacename>ApplicationListener</interfacename> configured to receive an
<classname>ImapIdleExceptionEvent</classname> or one of its super classes.
</para>
</section>
<section id="3.0-tcp-headers">
<title>Message Headers and TCP</title>
<para>
The TCP connection factories now enable the configuration of a flexible mechanism to
transfer selected headers (as well as the payload) over TCP. A new
<classname>TcpMessageMapper</classname>
enables the selection of the headers, and an appropriate (de)serializer needs to be
configured to write the resulting <interfacename>Map</interfacename> to the
TCP stream. A <classname>MapJsonSerializer</classname> is provided as a convenient
mechanism to transfer headers and payload over TCP.
For more information see <xref linkend="ip-headers"/>.
</para>
</section>
<section id="3.0-jms-mdca-te">
<title>JMS Message Driven Channel Adapter</title>
<para>
Previously, when configuring a <code>&lt;message-driven-channel-adapter/&gt;</code>, if you wished to
use a specific <interfacename>TaskExecutor</interfacename>, it was necessary to declare a container
bean and provide it to the adapter using the <code>container</code> attribute. The
<code>task-executor</code> is now provided, allowing it to be set directly on the adapter. This is
in addition to several other container attributes that were already available.
</para>
</section>
<section id="3.0-rmi-ec">
<title>RMI Inbound Gateway</title>
<para>
The RMI Inbound Gateway now supports an <code>error-channel</code> attribute. See
<xref linkend="rmi-inbound"/>.
</para>
</section>
<section id="3.0-xslt-transformer">
<title>XsltPayloadTransformer</title>
<para>
You can now specify the transformer factory class name using the
<code>transformer-factory-class</code> attribute. See <xref linkend="xml-xslt-payload-transformers"/>
</para>
</section>
</section>
</section>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<section xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="migration-3.0-4.0"
xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Changes between 3.0 and 4.0</title>
<para>
For an overview of the changes in Spring Integration 4.0 since version 3.0,
please see <xref linkend="whats-new"/>.
</para>
</section>

View File

@@ -4,8 +4,10 @@
xmlns:xi="http://www.w3.org/2001/XInclude">
<title>Change History</title>
<xi:include href="./changes-1.0-2.0.xml"/>
<xi:include href="./changes-2.0-2.1.xml"/>
<xi:include href="./changes-3.0-4.0.xml"/>
<xi:include href="./changes-2.2-3.0.xml"/>
<xi:include href="./changes-2.1-2.2.xml"/>
<xi:include href="./changes-2.0-2.1.xml"/>
<xi:include href="./changes-1.0-2.0.xml"/>
</appendix>

View File

@@ -69,9 +69,9 @@
<partintro id="spring-integration-intro">
<para>
For those who are already familiar with Spring Integration, this chapter
provides a brief overview of the new features of version 2.2. If you are
provides a brief overview of the new features of version 4.0. If you are
interested in the changes and features, that were introduced in earlier
versions, please take a look at chapter:
versions, please see chapter:
<xref linkend="history"/>

View File

@@ -2,682 +2,23 @@
<chapter xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="whats-new"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink">
<title>What's new in Spring Integration 3.0?</title>
<title>What's new in Spring Integration 4.0?</title>
<para>
This chapter provides an overview of the new features and improvements
that have been introduced with Spring Integration 3.0. If you are interested
that have been introduced with Spring Integration 4.0. If you are interested
in more details, please see the Issue Tracker tickets that
were resolved as part of the 3.0 development process.
were resolved as part of the 4.0 development process.
</para>
<section id="3.0-new-components">
<title>New Components</title>
<section id="3.0-request-mapping">
<title>HTTP Request Mapping</title>
<para>
The HTTP module now provides powerful Request Mapping support for Inbound Endpoints. Class <classname>UriPathHandlerMapping</classname>
was replaced by <classname>IntegrationRequestMappingHandlerMapping</classname>, which is registered under the bean name
<code>integrationRequestMappingHandlerMapping</code> in the application context. Upon parsing of the HTTP Inbound Endpoint,
a new <classname>IntegrationRequestMappingHandlerMapping</classname> bean is either registered or an existing bean is being reused.
To achieve flexible Request Mapping configuration, Spring Integration provides the <code>&lt;request-mapping/&gt;</code>
sub-element for the <code>&lt;http:inbound-channel-adapter/&gt;</code> and the <code>&lt;http:inbound-gateway/&gt;</code>.
Both HTTP Inbound Endpoints are now fully based on the Request Mapping infrastructure that was introduced with Spring MVC 3.1.
For example, multiple paths are supported on a single inbound endpoint.
For more information see <xref linkend="http-namespace"/>.
</para>
</section>
<section id="3.0-spel-customization">
<title>Spring Expression Language (SpEL) Configuration</title>
<para>
A new <classname>IntegrationEvaluationContextFactoryBean</classname> is provided to allow
configuration of custom <interfacename>PropertyAccessor</interfacename>s and functions for
use in SpEL expressions throughout the framework. For more information see <xref linkend="spel" />.
</para>
</section>
<section id="3.0-spel-functions">
<title>SpEL Functions Support</title>
<para>
To customize the SpEL <interfacename>EvaluationContext</interfacename> with static
<classname>Method</classname> functions, the new <code>&lt;spel-function/&gt;</code>
component is introduced. Two built-in functions are also provided (<code>#jsonPath</code>
and <code>#xpath</code>). For more information see <xref linkend="spel-functions" />.
</para>
</section>
<section id="3.0-spel-property-accessors">
<title>SpEL PropertyAccessors Support</title>
<para>
To customize the SpEL <interfacename>EvaluationContext</interfacename> with
<interfacename>PropertyAccessor</interfacename> implementations
the new <code>&lt;spel-property-accessors/&gt;</code> component is introduced.
For more information see <xref linkend="spel-property-accessors" />.
</para>
</section>
<section id="3.0-redis-new-components">
<title>Redis: New Components</title>
<para>
A new Redis-based
<interfacename><ulink url="http://docs.spring.io/spring-integration/docs/latest-ga/api/org/springframework/integration/store/MetadataStore.html">MetadataStore</ulink></interfacename>
implementation has been added. The <classname>RedisMetadataStore</classname> can
be used to maintain state of a <interfacename>MetadataStore</interfacename>
across application restarts. This new <interfacename>MetadataStore</interfacename>
implementation can be used with adapters such as:
</para>
<itemizedlist>
<listitem>Twitter Inbound Adapters</listitem>
<listitem>Feed Inbound Channel Adapter</listitem>
</itemizedlist>
<para>
New queue-based components have been added. The <code>&lt;int-redis:queue-inbound-channel-adapter/&gt;</code>
and the <code>&lt;int-redis:queue-outbound-channel-adapter/&gt;</code> components are provided
to perform 'right pop' and 'left push' operations on a Redis List, respectively.
</para>
<para>
For more information see <xref linkend="redis" />.
</para>
</section>
<section id="3.0-hcr">
<title>Header Channel Registry</title>
<para>
It is now possible to instruct the framework to store reply and error channels
in a registry for later resolution. This is useful for cases where
the <code>replyChannel</code> or <code>errorChannel</code> might be lost; for example
when serializing
a message. See <xref linkend="header-enricher"/> for more information.
</para>
</section>
<section id="3.0-configurable-mongo-MS">
<title>MongoDB support: New ConfigurableMongoDbMessageStore</title>
<para>
In addition to the existing <classname>eMongoDbMessageStore</classname>, a new
<classname>ConfigurableMongoDbMessageStore</classname> has been introduced.
This provides a more robust and flexible implementation of <interfacename>MessageStore</interfacename>
for MongoDB.
It does not have backward compatibility, with the existing store,
but it is recommended to use it for new applications. Existing applications can use it, but messages
in the old store will not be available.
See <xref linkend="mongodb"/> for more information.
</para>
</section>
<section id="3.0-syslog">
<title>Syslog Support</title>
<para>
Building on the 2.2 <classname>SyslogToMapTransformer</classname> Spring
Integration 3.0 now introduces
<code>UDP</code> and <code>TCP</code> inbound channel adapters especially tailored
for receiving SYSLOG messages. For more information, see
<xref linkend="syslog"/>.
</para>
</section>
<section id="3.0-tail">
<title>'Tail' Support</title>
<para>
File 'tail'ing inbound channel adapters are now provided to generate messages when
lines are added to the end of text files; see <xref linkend="file-tailing"/>.
</para>
</section>
<section id="3.0-jmx">
<title>JMX Support</title>
<para>
<itemizedlist>
<listitem>
A new <code>&lt;int-jmx:tree-polling-channel-adapter/&gt;</code> is provided; this
adapter queries the JMX MBean tree and sends a message with a payload that is the
graph of objects that matches the query. By default the MBeans are mapped to
primitives and simple Objects like Map, List and arrays - permitting simple
transformation, for example, to JSON.
</listitem>
<listitem>
The <classname>IntegrationMBeanExporter</classname> now allows the configuration of
a custom <classname>ObjectNamingStrategy</classname> using the <code>naming-strategy</code>
attribute.
</listitem>
</itemizedlist>
</para>
<para>
For more information, see <xref linkend="jmx"/>.
</para>
</section>
<section id="3.0-tcp-events">
<title>TCP/IP Connection Events and Connection Management</title>
<para>
<classname>TcpConnection</classname>s now emit
<interfacename>ApplicationEvent</interfacename>s (specifically
<classname>TcpConnectionEvent</classname>s) when connections are
opened, closed, or an exception occurs. This allows applications
to be informed of changes to TCP connections using the normal
Spring <interfacename>ApplicationListener</interfacename>
mechanism.
</para>
<para>
<classname>AbstractTcpConnection</classname> has been renamed
<classname>TcpConnectionSupport</classname>; custom connections that
are subclasses of this class, can use its methods to publish events.
Similarly, <classname>AbstractTcpConnectionInterceptor</classname> has
been renamed to <classname>TcpConnectionInterceptorSupport</classname>.
</para>
<para>
In addition, a new <code>&lt;int-ip:tcp-connection-event-inbound-channel-adapter/&gt;</code>
is provided; by default, this adapter sends all <classname>TcpConnectionEvent</classname>s
to a <interfacename>Channel</interfacename>.
</para>
<para>
Further, the TCP Connection Factories, now provide a new method
<code>getOpenConnectionIds()</code>, which returns a list of identifiers for all
open connections; this allows applications, for example, to broadcast to all
open connections.
</para>
<para>
Finally, the connection factories also provide a new method
<code>closeConnection(String connectionId)</code> which allows applications
to explicitly close a connection using its ID.
</para>
<para>
For more information see <xref linkend="tcp-events"/>.
</para>
</section>
<section id="3.0-inbound-script">
<title>Inbound Channel Adapter Script Support</title>
<para>
The <code>&lt;int:inbound-channel-adapter/&gt;</code> now supports <code>&lt;expression/&gt;</code>
and <code>&lt;script/&gt;</code> sub-elements to create a
<interfacename>MessageSource</interfacename>; see <xref linkend="channel-adapter-expressions-and-scripts"/>.
</para>
</section>
<section id="3.0-content-enricher-headers">
<title>Content Enricher: Headers Enrichment Support</title>
<para>
The Content Enricher now provides configuration for <code>&lt;header/&gt;</code>
sub-elements, to enrich the outbound Message with headers based on the reply Message from the underlying
message flow. For more information see <xref linkend="payload-enricher"/>.
</para>
</section>
</section>
<section id="3.0-general">
<section id="4.0-general">
<title>General Changes</title>
<section id="3.0-message-id">
<title>Message ID Generation</title>
<para>
Previously, message ids were generated using the JDK <code>UUID.randomUUID()</code> method. With this
release, the default mechanism has been changed to use a more efficient algorithm which
is significantly faster. In addition, the ability to change
the strategy used to generate message ids has been added.
For more information see <xref linkend="message-id-generation"/>.
</para>
</section>
<section id="3.0-gateway">
<title>&lt;gateway&gt; Changes</title>
<para>
<itemizedlist>
<listitem>
It is now possible to set common headers across all gateway methods, and more options
are provided for adding, to the message, information about which method was invoked.
</listitem>
<listitem>
It is now possible to entirely customize the way that gateway method calls are mapped
to messages.
</listitem>
<listitem>
The <classname>GatewayMethodMetadata</classname> is now public class and it makes possible flexibly
to configure the <classname>GatewayProxyFactoryBean</classname> programmatically from Java code.
</listitem>
</itemizedlist>
</para>
<para>
For more information see <xref linkend="gateway"/>.
</para>
</section>
<section id="3.0-http-endpointss">
<title>HTTP Endpoint Changes</title>
<para>
<itemizedlist>
<listitem>
<emphasis role="bold">Outbound Endpoint 'encode-uri'</emphasis> - <code>&lt;http:outbound-gateway/&gt;</code>
and <code>&lt;http:outbound-channel-adapter/&gt;</code> now
provide an <code>encode-uri</code> attribute to allow disabling the encoding of the URI object
before sending the request.
</listitem>
<listitem>
<emphasis role="bold">Inbound Endpoint 'merge-with-default-converters'</emphasis> -
<code>&lt;http:inbound-gateway/&gt;</code> and <code>&lt;http:inbound-channel-adapter/&gt;</code> now
have a <code>merge-with-default-converters</code> attribute to include the list of default
<interfacename>HttpMessageConverter</interfacename>s after the custom message converters.
</listitem>
<listitem>
<emphasis role="bold">'If-(Un)Modified-Since' HTTP Headers</emphasis> - previously,
'If-Modified-Since' and 'If-Unmodified-Since' HTTP headers were incorrectly processed
within from/to HTTP headers mapping in the <classname>DefaultHttpHeaderMapper</classname>.
Now, in addition correcting that issue, <classname>DefaultHttpHeaderMapper</classname> provides
date parsing from formatted strings for any HTTP headers that accept date-time values.
</listitem>
<listitem>
<emphasis role="bold">Inbound Endpoint Expression Variables</emphasis> -
In addition to the existing <emphasis>#requestParams</emphasis> and <emphasis>#pathVariables</emphasis>,
the <code>&lt;http:inbound-gateway/&gt;</code> and <code>&lt;http:inbound-channel-adapter/&gt;</code>
now support additional useful variables: <emphasis>#matrixVariables</emphasis>, <emphasis>#requestAttributes</emphasis>,
<emphasis>#requestHeaders</emphasis> and <emphasis>#cookies</emphasis>. These variables are available in
both payload and header expressions.
</listitem>
<listitem>
<emphasis role="bold">Outbound Endpoint 'uri-variables-expression'</emphasis> - HTTP Outbound Endpoints
now support the <code>uri-variables-expression</code> attribute to specify
an <interfacename>Expression</interfacename> to evaluate a <interfacename>Map</interfacename>
for all URI variable placeholders within URL template. This allows selection of a different
map of expressions based on the outgoing message.
</listitem>
</itemizedlist>
</para>
<para>
For more information see <xref linkend="http"/>.
</para>
</section>
<section id="3.0-json-transformers">
<title>Jackson Support (JSON)</title>
<para>
<itemizedlist>
<listitem>
A new abstraction for JSON conversion has been introduced. Implementations for Jackson 1.x
and Jackson 2 are currently provided, with the version being determined by presence on
the classpath. Previously, only Jackson 1.x was supported.
</listitem>
<listitem>
The <classname>ObjectToJsonTransformer</classname> and <classname>JsonToObjectTransformer</classname>
now emit/consume headers containing type information.
</listitem>
</itemizedlist>
</para>
<para>
For more information, see 'JSON Transformers' in <xref linkend="transformer"/>.
</para>
</section>
<section id="3.0-id-for-chain-sub-components">
<title>Chain Elements 'id' Attribute</title>
<para>
Previously, the <emphasis>id</emphasis> attribute for elements within a <code>&lt;chain&gt;</code> was
ignored and, in some cases, disallowed. Now, the <emphasis>id</emphasis> attribute is allowed
for all elements within a <code>&lt;chain&gt;</code>. The bean names of chain elements is a combination
of the surrounding chain's <emphasis>id</emphasis> and the <emphasis>id</emphasis> of the element
itself. For example: 'fooChain$child.fooTransformer.handler'.
For more information see <xref linkend="chain"/>.
</para>
</section>
<section id="3.0-corr-endpoint-empty-groups">
<title>Aggregator 'empty-group-min-timeout' property</title>
<para>
The <classname>AbstractCorrelatingMessageHandler</classname> provides a new property
<code>empty-group-min-timeout</code>
to allow empty group expiry to run on a longer schedule than expiring partial groups. Empty groups will
not be removed from the <interfacename>MessageStore</interfacename> until they have not been modified
for at least this number of milliseconds. For more information see <xref linkend="aggregator-config"/>.
</para>
</section>
<section id="3.0-filelistfilter">
<title>Persistent File List Filters (file, (S)FTP)</title>
<para>
New <classname>FileListFilter</classname>s that use a persistent <classname>MetadataStore</classname> are
now available. These can be used to prevent duplicate files after a system restart. See
<xref linkend="file-reading"/>, <xref linkend="ftp-inbound"/>, and <xref linkend="sftp-inbound"/> for more information.
</para>
</section>
<section id="3.0-scripting-variables">
<title>Scripting Support: Variables Changes</title>
<para>
A new <code>variables</code> attribute has been introduced for scripting components.
In addition, variable bindings are now allowed for inline scripts.
See <xref linkend="groovy"/> and <xref linkend="scripting"/> for more information.
</para>
</section>
<section id="3.0-direct-channel-lb-ref">
<title>Direct Channel Load Balancing configuration</title>
<para>
Previously, when configuring <classname>LoadBalancingStrategy</classname> on the channel's 'dispatcher' sub-element,
the only available option was to use a pre-defined enumeration of values which did not allow one to set a custom implementation
of the <classname>LoadBalancingStrategy</classname>. You can now use <code>load-balancer-ref</code> to provide
a reference to a custom implementation of the <classname>LoadBalancingStrategy</classname>.
For more information see <xref linkend="channel-implementations-directchannel"/>.
</para>
</section>
<section id="3.0-pub-sub">
<title>PublishSubscribeChannel Behavior</title>
<para>
Previously, sending to a &lt;publish-subscribe-channel/&gt; that had
no subscribers would return a <code>false</code> result. If used in conjunction with
a <classname>MessagingTemplate</classname>, this would result in an exception being thrown.
Now, the <classname>PublishSubscribeChannel</classname> has a property
<code>minSubscribers</code> (default 0). If the message is sent to at least the minimum
number of subscribers, the send is deemed to be successful (even if zero). If an application
is expecting to get an exception under these conditions, set the minimum subscribers to at
least 1.
</para>
</section>
<section id="3.0-(s)ftp-changes">
<title>FTP, SFTP and FTPS Changes</title>
<para>
<emphasis role="bold">The FTP, SFTP and FTPS endpoints no longer cache sessions by default</emphasis>
</para>
<para>
The deprecated <code>cached-sessions</code> attribute has been removed from all endpoints.
Previously, the embedded caching mechanism controlled by this attribute's value didn't
provide a way to limit the size of the cache, which could
grow indefinitely. The <classname>CachingConnectionFactory</classname> was introduced in
release 2.1 and it became the preferred (and is now the only) way to cache sessions.
</para>
<para>
The <classname>CachingConnectionFactory</classname> now provides a new method
<code>resetCache()</code>. This immediately closes idle sessions and causes in-use
sessions to be closed as and when they are returned to the cache.
</para>
<para>
The <classname>DefaultSftpSessionFactory</classname> (in conjunction with a
<classname>CachingSessionFactory</classname>) now supports multiplexing channels over
a single SSH connection (SFTP Only).
</para>
<para>
<emphasis role="bold">FTP, SFTP and FTPS Inbound Adapters</emphasis>
</para>
<para>
Previously, there was no way to override the default filter used to process files retrieved
from a remote server. The <code>filter</code> attribute determines which files are retrieved
but the <classname>FileReadingMessageSource</classname> uses an
<classname>AcceptOnceFileListFilter</classname>. This means that if a new copy of a file
is retrieved, with the same name as a previously copied file, no message was sent from the
adapter.
</para>
<para>
With this release, a new attribute <code>local-filter</code> allows you to override the
default filter, for example with an <classname>AcceptAllFileListFilter</classname>, or some
other custom filter.
</para>
<para>
For users that wish the behavior of the <classname>AcceptOnceFileListFilter</classname>
to be maintained across JVM executions, a custom filter that retains state, perhaps on
the file system, can now be configured.
</para>
<para>
Inbound Channel Adapters now support the <code>preserve-timestamp</code> attribute, which
sets the local file modified timestamp to the timestamp from the server (default false).
</para>
<para>
<emphasis role="bold">FTP, SFTP and FTPS Gateways</emphasis>
</para>
<para>
<itemizedlist>
<listitem>
The gateways now support the <emphasis role="bold">mv</emphasis> command, enabling
the renaming of remote files.
</listitem>
<listitem>
The gateways now support recursive <emphasis role="bold">ls</emphasis> and
<emphasis role="bold">mget</emphasis> commands, enabling
the retrieval of a remote file tree.
</listitem>
<listitem>
The gateways now support <emphasis role="bold">put</emphasis> and
<emphasis role="bold">mput</emphasis> commands, enabling
sending file(s) to the remote server.
</listitem>
<listitem>
The <code>local-filename-generator-expression</code> attribute is now supported,
enabling the naming of local files during retrieval. By default, the same
name as the remote file is used.
</listitem>
<listitem>
The <code>local-directory-expression</code> attribute is now supported,
enabling the naming of local directories during retrieval based on the remote directory.
</listitem>
</itemizedlist>
</para>
<para>
<emphasis role="bold">Remote File Template</emphasis>
</para>
<para>
A new higher-level abstraction (<classname>RemoteFileTemplate</classname>) is provided over the
<interfacename>Session</interfacename> implementations used by the FTP and SFTP modules. While it is
used internally by endpoints, this abstraction can also be used programmatically and, like all
Spring <code>*Template</code> implementations, reliably closes the underlying session while allowing
low level access to the session when needed.
</para>
<para>
For more information, see
<xref linkend="ftp"/> and <xref linkend="sftp"/>.
</para>
</section>
<section id="3.0-outbound-gateway-requires-reply">
<title>'requires-reply' Attribute for Outbound Gateways</title>
<para>
All Outbound Gateways (e.g. <code>&lt;jdbc:outbound-gateway/&gt;</code> or <code>&lt;jms:outbound-gateway/&gt;</code>)
are designed for 'request-reply' scenarios. A response is expected from the external service and
will be published to the <code>reply-channel</code>, or the <code>replyChannel</code> message header.
However, there are some cases where the external system might not always return a
result, e.g. a <code>&lt;jdbc:outbound-gateway/&gt;</code>, when a SELECT ends with an empty <interfacename>ResultSet</interfacename>
or, say, a Web Service is One-Way. An option is therefore needed to configure whether or not a
<emphasis>reply</emphasis> is required.
For this purpose, the <emphasis>requires-reply</emphasis> attribute has been introduced for Outbound Gateway components.
In most cases, the default value for <emphasis>requires-reply</emphasis> is <code>true</code> and, if there is not any result,
a <classname>ReplyRequiredException</classname> will be thrown. Changing the value to <code>false</code>
means that, if an external service doesn't return anything, the message-flow will end at that point,
similar to an Outbound Channel Adapter.
</para>
<note>
The WebService outbound gateway has an additional attribute <code>ignore-empty-responses</code>; this is used to
treat an empty String response as if no response was received. It is true by default but can be set to false to
allow the application to receive an empty String in the reply message payload. When the attribute is true an empty
string is treated as no response for the purposes of the <emphasis>requires-reply</emphasis> attribute.
<emphasis>requires-reply</emphasis> is false by default for the WebService outbound gateway.
</note>
<para>
Note, the <code>requiresReply</code> property was previously present in the <classname>AbstractReplyProducingMessageHandler</classname>
but set to <code>false</code>, and there wasn't any way to configure it on Outbound Gateways using the XML namespace.
</para>
<important>
Previously, a gateway receiving no reply would silently end the flow (with a DEBUG log message); with this change an
exception will now be thrown by default by most gateways. To revert to the previous behavior,
set <code>requires-reply</code> to false.
</important>
</section>
<section id="3.0-amqp-mapping">
<title>AMQP Outbound Gateway Header Mapping</title>
<para>
Previously, the &lt;int-amqp:outbound-gateway/&gt; mapped headers before invoking the message
converter, and the converter could overwrite headers such as <code>content-type</code>. The
outbound adapter maps the headers after the conversion, which means headers like
<code>content-type</code> from the outbound <code>Message</code> (if present) are used.
</para>
<para>
Starting with this release, the gateway now maps the headers after the message conversion,
consistent with the adapter. If your application relies on the previous behavior (where the
converter's headers overrode the mapped headers), you either need to filter those headers
(before the message reaches the gateway)
or set them appropriately. The headers affected by the <classname>SimpleMessageConverter</classname>
are <code>content-type</code> and <code>content-encoding</code>. Custom message converters
may set other headers.
</para>
</section>
<section id="3.0-stored-proc-sql-return-type">
<title>Stored Procedure Components Improvements</title>
<para>
For more complex database-specific types, not supported by the standard
<code>CallableStatement.getObject</code> method, 2 new additional
attributes were introduced to the <code>&lt;sql-parameter-definition/&gt;</code>
element with OUT-direction:
</para>
<itemizedlist>
<listitem><emphasis>type-name</emphasis></listitem>
<listitem><emphasis>return-type</emphasis></listitem>
</itemizedlist>
<para>
<para>
The <code>row-mapper</code> attribute of the Stored Procedure Inbound Channel Adapter
<code>&lt;returning-resultset/&gt;</code> sub-element
now supports a reference to a <interfacename>RowMapper</interfacename> bean
definition. Previously, it contained just a class name (which is still supported).
</para>
<para>
For more information see <xref linkend="stored-procedures"/>.
</para>
</para>
</section>
<section id="3.0-ws-outbound-uri-substitution">
<title>Web Service Outbound URI Configuration</title>
<para>
Web Service Outbound Gateway 'uri' attribute now supports <code>&lt;uri-variable/&gt;</code> substitution for all
URI-schemes supported by Spring Web Services. For more information see <xref linkend="outbound-uri"/>.
</para>
</section>
<section id="3.0-redis">
<title>Redis Adapter Changes</title>
<para>
<itemizedlist>
<listitem>
The Redis Inbound Channel Adapter can now use a <code>null</code> value for <code>serializer</code>
property, with the raw data being the message payload.
</listitem>
<listitem>
The Redis Outbound Channel Adapter now has the <code>topic-expression</code> property to determine
the Redis topic against the Message at runtime.
</listitem>
<listitem>
The Redis Inbound Channel Adapter, in addition to the existing <code>topics</code> attribute,
now has the <code>topic-patterns</code> attribute.
</listitem>
</itemizedlist>
</para>
<para>
For more information, see <xref linkend="redis"/>.
</para>
</section>
<section id="3.0-advising-filters">
<title>Advising Filters</title>
<para>
Previously, when a &lt;filter/&gt; had a &lt;request-handler-advice-chain/&gt;, the discard
action was all performed within the scope of the advice chain (including any downstream flow
on the <code>discard-channel</code>). The filter element now has an attribute
<code>discard-within-advice</code> (default <code>true</code>), to allow the discard action to
be performed after the advice chain completes. See <xref linkend="advising-filters"/>.
</para>
</section>
<section id="3.0-annotation-advice">
<title>Advising Endpoints using Annotations</title>
<para>
Request Handler Advice Chains can now be configured using annotations. See
<xref linkend="advising-with-annotations"/>.
</para>
</section>
<section id="3.0-o-t-s-t">
<title>ObjectToStringTransformer Improvements</title>
<para>
This transformer now correctly transforms <code>byte[]</code> and <code>char[]</code>
payloads to <classname>String</classname>. For more information see <xref linkend="transformer"/>.
</para>
</section>
<section id="3.0-jpa-changes">
<title>JPA Support Changes</title>
<para>
Payloads to <emphasis>persist</emphasis> or
<emphasis>merge</emphasis> can now be of type
<interfacename><ulink url="http://docs.oracle.com/javase/7/docs/api/java/lang/Iterable.html"
>java.lang.Iterable</ulink></interfacename>.
</para>
<para>
In that case, each object returned by the
<interfacename>Iterable</interfacename> is treated as
an entity and persisted or merged using the underlying
<interfacename>EntityManager</interfacename>.
<emphasis>NULL</emphasis> values returned by the iterator are ignored.
</para>
<para>
The JPA adapters now have additional attributes to optionally 'flush' and 'clear'
entities from the associated persistence context after performing persistence operations.
</para>
<para>
Retrieving gateways had no mechanism to specify the first record to be retrieved which
is a common use case. The retrieving gateways now support specifying this parameter
using a <code>first-result</code> and <code>first-result-expression</code> attributes
to the gateway definition. <xref linkend="jpa-retrieving-outbound-gateway"/>.
</para>
<para>
The JPA retrieving gateway and inbound adapter now have an attribute to specify the maximum
number of results in a result set as an expression. In addition, the
<code>max-results</code> attribute has been introduced to replace
<code>max-number-of-results</code>, which has been deprecated.
<code>max-results</code> and <code>max-results-expression</code>
are used to provide the maximum number of results,
or an expression to compute the maximum number of results, respectively, in the
result set.
</para>
<para>For more information see <xref linkend="jpa"/>.</para>
</section>
<section id="3.0-dalay-expression">
<title>Delayer: delay expression</title>
<para>
Previously, the <code>&lt;delayer&gt;</code> provided a <code>delay-header-name</code> attribute
to determine the <emphasis>delay</emphasis> value at runtime. In complex cases it was necessary
to precede the <code>&lt;delayer&gt;</code> with a <code>&lt;header-enricher&gt;</code>.
Spring Integration 3.0 introduced the <code>expression</code> attribute and <code>expression</code>
sub-element for dynamic delay determination. The <code>delay-header-name</code> attribute is now deprecated
because the header evaluation can be specified in the <code>expression</code>. In addition,
the <code>ignore-expression-failures</code> was introduced to control the behavior when an
expression evaluation fails.
For more information see <xref linkend="delayer"/>.
</para>
</section>
<section id="3.0-jdbc-mysql-v5_6_4">
<title>JDBC Message Store Improvements</title>
<para>
<emphasis>Spring Integration 3.0</emphasis> adds a new set of DDL
scripts for <emphasis>MySQL</emphasis> version 5.6.4 and higher.
Now <emphasis>MySQL</emphasis> supports <emphasis>fractional
seconds</emphasis> and is thus improving the FIFO ordering when
polling from a MySQL-based Message Store. For more information,
please see <xref linkend="jdbc-message-store-generic"/>.
</para>
</section>
<section id="3.0-event-for-imap-idle">
<title>IMAP Idle Connection Exceptions</title>
<para>
Previously, if an IMAP idle connection failed, it was logged but there was no mechanism to
inform an application. Such exceptions now generate <classname>ApplicationEvent</classname>s.
Applications can obtain these events using an <code>&lt;int-event:inbound-channel-adapter&gt;</code>
or any <interfacename>ApplicationListener</interfacename> configured to receive an
<classname>ImapIdleExceptionEvent</classname> or one of its super classes.
</para>
</section>
<section id="3.0-tcp-headers">
<title>Message Headers and TCP</title>
<para>
The TCP connection factories now enable the configuration of a flexible mechanism to
transfer selected headers (as well as the payload) over TCP. A new
<classname>TcpMessageMapper</classname>
enables the selection of the headers, and an appropriate (de)serializer needs to be
configured to write the resulting <interfacename>Map</interfacename> to the
TCP stream. A <classname>MapJsonSerializer</classname> is provided as a convenient
mechanism to transfer headers and payload over TCP.
For more information see <xref linkend="ip-headers"/>.
</para>
</section>
<section id="3.0-jms-mdca-te">
<title>JMS Message Driven Channel Adapter</title>
<para>
Previously, when configuring a <code>&lt;message-driven-channel-adapter/&gt;</code>, if you wished to
use a specific <interfacename>TaskExecutor</interfacename>, it was necessary to declare a container
bean and provide it to the adapter using the <code>container</code> attribute. The
<code>task-executor</code> is now provided, allowing it to be set directly on the adapter. This is
in addition to several other container attributes that were already available.
</para>
</section>
<section id="3.0-rmi-ec">
<title>RMI Inbound Gateway</title>
<para>
The RMI Inbound Gateway now supports an <code>error-channel</code> attribute. See
<xref linkend="rmi-inbound"/>.
</para>
</section>
<section id="3.0-xslt-transformer">
<title>XsltPayloadTransformer</title>
<para>
You can now specify the transformer factory class name using the
<code>transformer-factory-class</code> attribute. See <xref linkend="xml-xslt-payload-transformers"/>
</para>
</section>
<para>
Core messaging abstractions (<interfacename>Message</interfacename>,
<interfacename>MessageChannel</interfacename> etc) have moved to the Spring
Framework <code>spring-messaging</code> module. Users who reference these
classes directly in their code will need to make changes as described in
the first section of the
<ulink url="https://github.com/spring-projects/spring-integration/wiki/Spring-Integration-3.0-to-4.0-Migration-Guide"
>Migration Guide</ulink>.
</para>
</section>
</chapter>