INT-4049:Fix FileSplitter for Message item
JIRA: https://jira.spring.io/browse/INT-4049 Since the `FileSplitter` can now return `Message<?>` as item for markers, we should ensure the original headers copying, e.g. `file_remoteSession` Also change `FtpServerOutboundTests-context.xml` to check that new `file_marker` header works well
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -112,12 +112,12 @@ public abstract class AbstractMessageSplitter extends AbstractReplyProducingMess
|
||||
Object correlationId, int sequenceNumber, int sequenceSize) {
|
||||
AbstractIntegrationMessageBuilder<?> builder;
|
||||
if (item instanceof Message) {
|
||||
builder = this.getMessageBuilderFactory().fromMessage((Message<?>) item);
|
||||
builder = getMessageBuilderFactory().fromMessage((Message<?>) item);
|
||||
}
|
||||
else {
|
||||
builder = this.getMessageBuilderFactory().withPayload(item);
|
||||
builder.copyHeaders(headers);
|
||||
builder = getMessageBuilderFactory().withPayload(item);
|
||||
}
|
||||
builder.copyHeaders(headers);
|
||||
if (this.applySequence) {
|
||||
builder.pushSequenceDetails(correlationId, sequenceNumber, sequenceSize);
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
</int:chain>
|
||||
|
||||
<int:service-activator input-channel="markers"
|
||||
expression="payload.mark.toString().equals('END') ? headers['file_remoteSession'].close() : null"/>
|
||||
expression="'END'.equals(headers['file_marker']) ? headers['file_remoteSession'].close() : null"/>
|
||||
|
||||
<int:channel id="appending" />
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
</int:chain>
|
||||
|
||||
<int:service-activator input-channel="markers"
|
||||
expression="payload.mark.toString().equals('END') ? headers['file_remoteSession'].close() : null"/>
|
||||
expression="headers['file_marker']?.equals('END') ? headers['file_remoteSession'].close() : null"/>
|
||||
|
||||
<int-sftp:outbound-gateway
|
||||
session-factory="sftpSessionFactory"
|
||||
|
||||
Reference in New Issue
Block a user