Polling a local folder and sending files to FTP using Spring Integration
I'm using spring integration output channel to send files to FTP server(s), from the researches I did, I was able to send one file from a folder to the ftp, my concern is that I want to keep on polling a local folder ex: BEY/finalBEY.csv and once there is a file with this name "finalBEY.csv" I want to send it to a certain FTP server and if there is no file in the folder I want to keep on watching or polling the folder until there is a one, I'm sure this is possible but not able to find the solution or the proper coding, thanks for helping
Code I used:
public IntegrationFlow ftpOutboundFlow(Branch myBranch){
return IntegrationFlows.from(OUTBOUND_CHANNEL)
.handle(Ftp.outboundAdapter(createNewFtpSessionFactory(myBranch), FileExistsMode.REPLACE)
.useTemporaryFileName(true)
.autoCreateDirectory(true)
//.remoteFileSeparator("/")
.fileNameExpression("headers['" + FileHeaders.FILENAME + "']")
//.fileNameExpression("BEY/FEFOexportBEY.csv")
.remoteDirectory(myBranch.getFolderPath()))
.get();
}
@Bean
public MessageChannel OUTBOUND_CHANNEL(){
return new PublishSubscribeChannel();
}
@MessagingGateway
public interface MyGateway {
@Gateway(requestChannel = OUTBOUND_CHANNEL)
void sendToFtp(File file);
}
In the controller where I'm registering the flow and sending a file.
private void addFlowftpOutbound(String name) {
branch = branchService.getById(Long.valueOf(name));
System.out.println(branch.getBranchCode());
IntegrationFlow flow = ftIntegration.ftpOutboundFlow(branch);
this.flowContext.registration(flow).id(name +"o").register();
myGateway.sendToFtp(new File("BEY/finalBEY.csv"));
}
Consol trial output:
When no file in BEY folder, which is logical.
2018-11-27 08:32:47.793 WARN 6420 --- [nio-8081-exec-9] o.s.i.ftp.session.FtpRemoteFileTemplate : File BEYfinalBEY.csv does not exist
After dropping finalBEY.csv in the folder, the inbound flow just reading what is new there in the folder and as you can see nothing is sent, as well I checked the ftp server and nothing is there, note that if the file is already there when I run the app, definitely it will send it, this is already tested.
2018-11-27 08:33:17.985 INFO 6420 --- [ask-scheduler-2] f.s.s.configuration.FTIntegration : flow=stockInboundFlowFromAFT, message=incoming file: BEYfinalBEY.csv
2018-11-27 08:33:17.985 INFO 6420 --- [ask-scheduler-2] f.s.s.configuration.FTIntegration : flow=stockIntermediateStageChannel, message=rename file: BEYfinalBEY.csv
spring spring-integration
add a comment |
I'm using spring integration output channel to send files to FTP server(s), from the researches I did, I was able to send one file from a folder to the ftp, my concern is that I want to keep on polling a local folder ex: BEY/finalBEY.csv and once there is a file with this name "finalBEY.csv" I want to send it to a certain FTP server and if there is no file in the folder I want to keep on watching or polling the folder until there is a one, I'm sure this is possible but not able to find the solution or the proper coding, thanks for helping
Code I used:
public IntegrationFlow ftpOutboundFlow(Branch myBranch){
return IntegrationFlows.from(OUTBOUND_CHANNEL)
.handle(Ftp.outboundAdapter(createNewFtpSessionFactory(myBranch), FileExistsMode.REPLACE)
.useTemporaryFileName(true)
.autoCreateDirectory(true)
//.remoteFileSeparator("/")
.fileNameExpression("headers['" + FileHeaders.FILENAME + "']")
//.fileNameExpression("BEY/FEFOexportBEY.csv")
.remoteDirectory(myBranch.getFolderPath()))
.get();
}
@Bean
public MessageChannel OUTBOUND_CHANNEL(){
return new PublishSubscribeChannel();
}
@MessagingGateway
public interface MyGateway {
@Gateway(requestChannel = OUTBOUND_CHANNEL)
void sendToFtp(File file);
}
In the controller where I'm registering the flow and sending a file.
private void addFlowftpOutbound(String name) {
branch = branchService.getById(Long.valueOf(name));
System.out.println(branch.getBranchCode());
IntegrationFlow flow = ftIntegration.ftpOutboundFlow(branch);
this.flowContext.registration(flow).id(name +"o").register();
myGateway.sendToFtp(new File("BEY/finalBEY.csv"));
}
Consol trial output:
When no file in BEY folder, which is logical.
2018-11-27 08:32:47.793 WARN 6420 --- [nio-8081-exec-9] o.s.i.ftp.session.FtpRemoteFileTemplate : File BEYfinalBEY.csv does not exist
After dropping finalBEY.csv in the folder, the inbound flow just reading what is new there in the folder and as you can see nothing is sent, as well I checked the ftp server and nothing is there, note that if the file is already there when I run the app, definitely it will send it, this is already tested.
2018-11-27 08:33:17.985 INFO 6420 --- [ask-scheduler-2] f.s.s.configuration.FTIntegration : flow=stockInboundFlowFromAFT, message=incoming file: BEYfinalBEY.csv
2018-11-27 08:33:17.985 INFO 6420 --- [ask-scheduler-2] f.s.s.configuration.FTIntegration : flow=stockIntermediateStageChannel, message=rename file: BEYfinalBEY.csv
spring spring-integration
add a comment |
I'm using spring integration output channel to send files to FTP server(s), from the researches I did, I was able to send one file from a folder to the ftp, my concern is that I want to keep on polling a local folder ex: BEY/finalBEY.csv and once there is a file with this name "finalBEY.csv" I want to send it to a certain FTP server and if there is no file in the folder I want to keep on watching or polling the folder until there is a one, I'm sure this is possible but not able to find the solution or the proper coding, thanks for helping
Code I used:
public IntegrationFlow ftpOutboundFlow(Branch myBranch){
return IntegrationFlows.from(OUTBOUND_CHANNEL)
.handle(Ftp.outboundAdapter(createNewFtpSessionFactory(myBranch), FileExistsMode.REPLACE)
.useTemporaryFileName(true)
.autoCreateDirectory(true)
//.remoteFileSeparator("/")
.fileNameExpression("headers['" + FileHeaders.FILENAME + "']")
//.fileNameExpression("BEY/FEFOexportBEY.csv")
.remoteDirectory(myBranch.getFolderPath()))
.get();
}
@Bean
public MessageChannel OUTBOUND_CHANNEL(){
return new PublishSubscribeChannel();
}
@MessagingGateway
public interface MyGateway {
@Gateway(requestChannel = OUTBOUND_CHANNEL)
void sendToFtp(File file);
}
In the controller where I'm registering the flow and sending a file.
private void addFlowftpOutbound(String name) {
branch = branchService.getById(Long.valueOf(name));
System.out.println(branch.getBranchCode());
IntegrationFlow flow = ftIntegration.ftpOutboundFlow(branch);
this.flowContext.registration(flow).id(name +"o").register();
myGateway.sendToFtp(new File("BEY/finalBEY.csv"));
}
Consol trial output:
When no file in BEY folder, which is logical.
2018-11-27 08:32:47.793 WARN 6420 --- [nio-8081-exec-9] o.s.i.ftp.session.FtpRemoteFileTemplate : File BEYfinalBEY.csv does not exist
After dropping finalBEY.csv in the folder, the inbound flow just reading what is new there in the folder and as you can see nothing is sent, as well I checked the ftp server and nothing is there, note that if the file is already there when I run the app, definitely it will send it, this is already tested.
2018-11-27 08:33:17.985 INFO 6420 --- [ask-scheduler-2] f.s.s.configuration.FTIntegration : flow=stockInboundFlowFromAFT, message=incoming file: BEYfinalBEY.csv
2018-11-27 08:33:17.985 INFO 6420 --- [ask-scheduler-2] f.s.s.configuration.FTIntegration : flow=stockIntermediateStageChannel, message=rename file: BEYfinalBEY.csv
spring spring-integration
I'm using spring integration output channel to send files to FTP server(s), from the researches I did, I was able to send one file from a folder to the ftp, my concern is that I want to keep on polling a local folder ex: BEY/finalBEY.csv and once there is a file with this name "finalBEY.csv" I want to send it to a certain FTP server and if there is no file in the folder I want to keep on watching or polling the folder until there is a one, I'm sure this is possible but not able to find the solution or the proper coding, thanks for helping
Code I used:
public IntegrationFlow ftpOutboundFlow(Branch myBranch){
return IntegrationFlows.from(OUTBOUND_CHANNEL)
.handle(Ftp.outboundAdapter(createNewFtpSessionFactory(myBranch), FileExistsMode.REPLACE)
.useTemporaryFileName(true)
.autoCreateDirectory(true)
//.remoteFileSeparator("/")
.fileNameExpression("headers['" + FileHeaders.FILENAME + "']")
//.fileNameExpression("BEY/FEFOexportBEY.csv")
.remoteDirectory(myBranch.getFolderPath()))
.get();
}
@Bean
public MessageChannel OUTBOUND_CHANNEL(){
return new PublishSubscribeChannel();
}
@MessagingGateway
public interface MyGateway {
@Gateway(requestChannel = OUTBOUND_CHANNEL)
void sendToFtp(File file);
}
In the controller where I'm registering the flow and sending a file.
private void addFlowftpOutbound(String name) {
branch = branchService.getById(Long.valueOf(name));
System.out.println(branch.getBranchCode());
IntegrationFlow flow = ftIntegration.ftpOutboundFlow(branch);
this.flowContext.registration(flow).id(name +"o").register();
myGateway.sendToFtp(new File("BEY/finalBEY.csv"));
}
Consol trial output:
When no file in BEY folder, which is logical.
2018-11-27 08:32:47.793 WARN 6420 --- [nio-8081-exec-9] o.s.i.ftp.session.FtpRemoteFileTemplate : File BEYfinalBEY.csv does not exist
After dropping finalBEY.csv in the folder, the inbound flow just reading what is new there in the folder and as you can see nothing is sent, as well I checked the ftp server and nothing is there, note that if the file is already there when I run the app, definitely it will send it, this is already tested.
2018-11-27 08:33:17.985 INFO 6420 --- [ask-scheduler-2] f.s.s.configuration.FTIntegration : flow=stockInboundFlowFromAFT, message=incoming file: BEYfinalBEY.csv
2018-11-27 08:33:17.985 INFO 6420 --- [ask-scheduler-2] f.s.s.configuration.FTIntegration : flow=stockIntermediateStageChannel, message=rename file: BEYfinalBEY.csv
spring spring-integration
spring spring-integration
edited Nov 27 '18 at 6:44
Elias Khattar
asked Nov 26 '18 at 7:20
Elias KhattarElias Khattar
436
436
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
It looks like you are polling the directory yourself (and using a gateway). Simply ignore files where the final
file does not exist.
You can use a polled FileReadingMessageSource
to poll the directory and implement a custom FileListFilter
.
The custom filter should filter out files where the final
file does not yet exist.
Great I will try that and give a feedback, so if I see finalBEY.csv in the folder, I'm sending it to ftp, can I delete it after sending so that I wait for new file with same name and send the new one again? When you say final, is this a property that I need to invoke or this is something that I should implement in FileListerFilter ?Is there an exercise I can take look at?Thanks@Gary Russell
– Elias Khattar
Nov 26 '18 at 18:26
Sorry - I thought you meant you sendfoo.csv
and only want to process it whenfinalFoo.csv
is there too. For that you would need a custom filter. If you are just looking for a single file, the standard pattern filter will work for you. However, you need to be careful not to process the file while it is still being written. That is usually done by sending a second file or writing it with a different name and rename it when the writing is complete.
– Gary Russell
Nov 26 '18 at 18:51
Not a problem, so if you remember on the first part that you helped me with when pulling csv files from ftp with name FEFOExportBEY.csv I'm processing this file and generating a new file naming it finalBEY.csv, this one I want to send it back to FTP server and remove it from local and the original file I want to archive it for historic reasons, for the writing of the file, might use like what I did in inbound writing with dif ext.and then changing it to csv, is there an example to look at that might contain some of those solutions and will manage trying to accomplish the rest?@Gary Russell
– Elias Khattar
Nov 26 '18 at 19:24
TheFileWritingMessageHandler
does exactly that by default - writes the file asfoo.txt.writing
and then renames it tofoo.txt
afterwards.
– Gary Russell
Nov 26 '18 at 20:28
I'm trying to see if my coding is working as needed,I removed finalBEY.csv from the folder and ran the app (same code as above). To make sure that I'm polling the directory I dropped a file in the folder BEY with name finalBEY.csv but the app did not pick it up and sent it to ftp, I think i'm missing something here...maybe something is set to read one time from the folder? not sure :S ..I'm editing the code to show the consol output of this trial@Gary Russell
– Elias Khattar
Nov 27 '18 at 6:39
|
show 3 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53476326%2fpolling-a-local-folder-and-sending-files-to-ftp-using-spring-integration%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It looks like you are polling the directory yourself (and using a gateway). Simply ignore files where the final
file does not exist.
You can use a polled FileReadingMessageSource
to poll the directory and implement a custom FileListFilter
.
The custom filter should filter out files where the final
file does not yet exist.
Great I will try that and give a feedback, so if I see finalBEY.csv in the folder, I'm sending it to ftp, can I delete it after sending so that I wait for new file with same name and send the new one again? When you say final, is this a property that I need to invoke or this is something that I should implement in FileListerFilter ?Is there an exercise I can take look at?Thanks@Gary Russell
– Elias Khattar
Nov 26 '18 at 18:26
Sorry - I thought you meant you sendfoo.csv
and only want to process it whenfinalFoo.csv
is there too. For that you would need a custom filter. If you are just looking for a single file, the standard pattern filter will work for you. However, you need to be careful not to process the file while it is still being written. That is usually done by sending a second file or writing it with a different name and rename it when the writing is complete.
– Gary Russell
Nov 26 '18 at 18:51
Not a problem, so if you remember on the first part that you helped me with when pulling csv files from ftp with name FEFOExportBEY.csv I'm processing this file and generating a new file naming it finalBEY.csv, this one I want to send it back to FTP server and remove it from local and the original file I want to archive it for historic reasons, for the writing of the file, might use like what I did in inbound writing with dif ext.and then changing it to csv, is there an example to look at that might contain some of those solutions and will manage trying to accomplish the rest?@Gary Russell
– Elias Khattar
Nov 26 '18 at 19:24
TheFileWritingMessageHandler
does exactly that by default - writes the file asfoo.txt.writing
and then renames it tofoo.txt
afterwards.
– Gary Russell
Nov 26 '18 at 20:28
I'm trying to see if my coding is working as needed,I removed finalBEY.csv from the folder and ran the app (same code as above). To make sure that I'm polling the directory I dropped a file in the folder BEY with name finalBEY.csv but the app did not pick it up and sent it to ftp, I think i'm missing something here...maybe something is set to read one time from the folder? not sure :S ..I'm editing the code to show the consol output of this trial@Gary Russell
– Elias Khattar
Nov 27 '18 at 6:39
|
show 3 more comments
It looks like you are polling the directory yourself (and using a gateway). Simply ignore files where the final
file does not exist.
You can use a polled FileReadingMessageSource
to poll the directory and implement a custom FileListFilter
.
The custom filter should filter out files where the final
file does not yet exist.
Great I will try that and give a feedback, so if I see finalBEY.csv in the folder, I'm sending it to ftp, can I delete it after sending so that I wait for new file with same name and send the new one again? When you say final, is this a property that I need to invoke or this is something that I should implement in FileListerFilter ?Is there an exercise I can take look at?Thanks@Gary Russell
– Elias Khattar
Nov 26 '18 at 18:26
Sorry - I thought you meant you sendfoo.csv
and only want to process it whenfinalFoo.csv
is there too. For that you would need a custom filter. If you are just looking for a single file, the standard pattern filter will work for you. However, you need to be careful not to process the file while it is still being written. That is usually done by sending a second file or writing it with a different name and rename it when the writing is complete.
– Gary Russell
Nov 26 '18 at 18:51
Not a problem, so if you remember on the first part that you helped me with when pulling csv files from ftp with name FEFOExportBEY.csv I'm processing this file and generating a new file naming it finalBEY.csv, this one I want to send it back to FTP server and remove it from local and the original file I want to archive it for historic reasons, for the writing of the file, might use like what I did in inbound writing with dif ext.and then changing it to csv, is there an example to look at that might contain some of those solutions and will manage trying to accomplish the rest?@Gary Russell
– Elias Khattar
Nov 26 '18 at 19:24
TheFileWritingMessageHandler
does exactly that by default - writes the file asfoo.txt.writing
and then renames it tofoo.txt
afterwards.
– Gary Russell
Nov 26 '18 at 20:28
I'm trying to see if my coding is working as needed,I removed finalBEY.csv from the folder and ran the app (same code as above). To make sure that I'm polling the directory I dropped a file in the folder BEY with name finalBEY.csv but the app did not pick it up and sent it to ftp, I think i'm missing something here...maybe something is set to read one time from the folder? not sure :S ..I'm editing the code to show the consol output of this trial@Gary Russell
– Elias Khattar
Nov 27 '18 at 6:39
|
show 3 more comments
It looks like you are polling the directory yourself (and using a gateway). Simply ignore files where the final
file does not exist.
You can use a polled FileReadingMessageSource
to poll the directory and implement a custom FileListFilter
.
The custom filter should filter out files where the final
file does not yet exist.
It looks like you are polling the directory yourself (and using a gateway). Simply ignore files where the final
file does not exist.
You can use a polled FileReadingMessageSource
to poll the directory and implement a custom FileListFilter
.
The custom filter should filter out files where the final
file does not yet exist.
answered Nov 26 '18 at 15:07
Gary RussellGary Russell
84.6k85077
84.6k85077
Great I will try that and give a feedback, so if I see finalBEY.csv in the folder, I'm sending it to ftp, can I delete it after sending so that I wait for new file with same name and send the new one again? When you say final, is this a property that I need to invoke or this is something that I should implement in FileListerFilter ?Is there an exercise I can take look at?Thanks@Gary Russell
– Elias Khattar
Nov 26 '18 at 18:26
Sorry - I thought you meant you sendfoo.csv
and only want to process it whenfinalFoo.csv
is there too. For that you would need a custom filter. If you are just looking for a single file, the standard pattern filter will work for you. However, you need to be careful not to process the file while it is still being written. That is usually done by sending a second file or writing it with a different name and rename it when the writing is complete.
– Gary Russell
Nov 26 '18 at 18:51
Not a problem, so if you remember on the first part that you helped me with when pulling csv files from ftp with name FEFOExportBEY.csv I'm processing this file and generating a new file naming it finalBEY.csv, this one I want to send it back to FTP server and remove it from local and the original file I want to archive it for historic reasons, for the writing of the file, might use like what I did in inbound writing with dif ext.and then changing it to csv, is there an example to look at that might contain some of those solutions and will manage trying to accomplish the rest?@Gary Russell
– Elias Khattar
Nov 26 '18 at 19:24
TheFileWritingMessageHandler
does exactly that by default - writes the file asfoo.txt.writing
and then renames it tofoo.txt
afterwards.
– Gary Russell
Nov 26 '18 at 20:28
I'm trying to see if my coding is working as needed,I removed finalBEY.csv from the folder and ran the app (same code as above). To make sure that I'm polling the directory I dropped a file in the folder BEY with name finalBEY.csv but the app did not pick it up and sent it to ftp, I think i'm missing something here...maybe something is set to read one time from the folder? not sure :S ..I'm editing the code to show the consol output of this trial@Gary Russell
– Elias Khattar
Nov 27 '18 at 6:39
|
show 3 more comments
Great I will try that and give a feedback, so if I see finalBEY.csv in the folder, I'm sending it to ftp, can I delete it after sending so that I wait for new file with same name and send the new one again? When you say final, is this a property that I need to invoke or this is something that I should implement in FileListerFilter ?Is there an exercise I can take look at?Thanks@Gary Russell
– Elias Khattar
Nov 26 '18 at 18:26
Sorry - I thought you meant you sendfoo.csv
and only want to process it whenfinalFoo.csv
is there too. For that you would need a custom filter. If you are just looking for a single file, the standard pattern filter will work for you. However, you need to be careful not to process the file while it is still being written. That is usually done by sending a second file or writing it with a different name and rename it when the writing is complete.
– Gary Russell
Nov 26 '18 at 18:51
Not a problem, so if you remember on the first part that you helped me with when pulling csv files from ftp with name FEFOExportBEY.csv I'm processing this file and generating a new file naming it finalBEY.csv, this one I want to send it back to FTP server and remove it from local and the original file I want to archive it for historic reasons, for the writing of the file, might use like what I did in inbound writing with dif ext.and then changing it to csv, is there an example to look at that might contain some of those solutions and will manage trying to accomplish the rest?@Gary Russell
– Elias Khattar
Nov 26 '18 at 19:24
TheFileWritingMessageHandler
does exactly that by default - writes the file asfoo.txt.writing
and then renames it tofoo.txt
afterwards.
– Gary Russell
Nov 26 '18 at 20:28
I'm trying to see if my coding is working as needed,I removed finalBEY.csv from the folder and ran the app (same code as above). To make sure that I'm polling the directory I dropped a file in the folder BEY with name finalBEY.csv but the app did not pick it up and sent it to ftp, I think i'm missing something here...maybe something is set to read one time from the folder? not sure :S ..I'm editing the code to show the consol output of this trial@Gary Russell
– Elias Khattar
Nov 27 '18 at 6:39
Great I will try that and give a feedback, so if I see finalBEY.csv in the folder, I'm sending it to ftp, can I delete it after sending so that I wait for new file with same name and send the new one again? When you say final, is this a property that I need to invoke or this is something that I should implement in FileListerFilter ?Is there an exercise I can take look at?Thanks@Gary Russell
– Elias Khattar
Nov 26 '18 at 18:26
Great I will try that and give a feedback, so if I see finalBEY.csv in the folder, I'm sending it to ftp, can I delete it after sending so that I wait for new file with same name and send the new one again? When you say final, is this a property that I need to invoke or this is something that I should implement in FileListerFilter ?Is there an exercise I can take look at?Thanks@Gary Russell
– Elias Khattar
Nov 26 '18 at 18:26
Sorry - I thought you meant you send
foo.csv
and only want to process it when finalFoo.csv
is there too. For that you would need a custom filter. If you are just looking for a single file, the standard pattern filter will work for you. However, you need to be careful not to process the file while it is still being written. That is usually done by sending a second file or writing it with a different name and rename it when the writing is complete.– Gary Russell
Nov 26 '18 at 18:51
Sorry - I thought you meant you send
foo.csv
and only want to process it when finalFoo.csv
is there too. For that you would need a custom filter. If you are just looking for a single file, the standard pattern filter will work for you. However, you need to be careful not to process the file while it is still being written. That is usually done by sending a second file or writing it with a different name and rename it when the writing is complete.– Gary Russell
Nov 26 '18 at 18:51
Not a problem, so if you remember on the first part that you helped me with when pulling csv files from ftp with name FEFOExportBEY.csv I'm processing this file and generating a new file naming it finalBEY.csv, this one I want to send it back to FTP server and remove it from local and the original file I want to archive it for historic reasons, for the writing of the file, might use like what I did in inbound writing with dif ext.and then changing it to csv, is there an example to look at that might contain some of those solutions and will manage trying to accomplish the rest?@Gary Russell
– Elias Khattar
Nov 26 '18 at 19:24
Not a problem, so if you remember on the first part that you helped me with when pulling csv files from ftp with name FEFOExportBEY.csv I'm processing this file and generating a new file naming it finalBEY.csv, this one I want to send it back to FTP server and remove it from local and the original file I want to archive it for historic reasons, for the writing of the file, might use like what I did in inbound writing with dif ext.and then changing it to csv, is there an example to look at that might contain some of those solutions and will manage trying to accomplish the rest?@Gary Russell
– Elias Khattar
Nov 26 '18 at 19:24
The
FileWritingMessageHandler
does exactly that by default - writes the file as foo.txt.writing
and then renames it to foo.txt
afterwards.– Gary Russell
Nov 26 '18 at 20:28
The
FileWritingMessageHandler
does exactly that by default - writes the file as foo.txt.writing
and then renames it to foo.txt
afterwards.– Gary Russell
Nov 26 '18 at 20:28
I'm trying to see if my coding is working as needed,I removed finalBEY.csv from the folder and ran the app (same code as above). To make sure that I'm polling the directory I dropped a file in the folder BEY with name finalBEY.csv but the app did not pick it up and sent it to ftp, I think i'm missing something here...maybe something is set to read one time from the folder? not sure :S ..I'm editing the code to show the consol output of this trial@Gary Russell
– Elias Khattar
Nov 27 '18 at 6:39
I'm trying to see if my coding is working as needed,I removed finalBEY.csv from the folder and ran the app (same code as above). To make sure that I'm polling the directory I dropped a file in the folder BEY with name finalBEY.csv but the app did not pick it up and sent it to ftp, I think i'm missing something here...maybe something is set to read one time from the folder? not sure :S ..I'm editing the code to show the consol output of this trial@Gary Russell
– Elias Khattar
Nov 27 '18 at 6:39
|
show 3 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53476326%2fpolling-a-local-folder-and-sending-files-to-ftp-using-spring-integration%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown