Thank you very much for you quick response, i tough there were a new parameter to set, but if say it is totally transparent, it's ok for me.
Sorry not to have tested carefully before, i was expecting some overwrite file parameter.
Thanks
Thank you very much for you quick response, i tough there were a new parameter to set, but if say it is totally transparent, it's ok for me.
Sorry not to have tested carefully before, i was expecting some overwrite file parameter.
Thanks
well it doesn't seem to work for me:
springintegration.png
after writing file with the same name, i still have two files (one with .writing extension, and the old one)
I have no error in log file.
Can you help ?
thanks
Can you describe your environment and share your config so we can try to reproduce it?
Oleg Zhurakousky
Spring Integration team
http://twitter.com/z_oleg
http://blog.springsource.com/author/ozhurakousky/
Sure:
- windows 7 Pro SP1
- all spring integration components updated to 2.0.5
I am using a home made component which is inheriting from an AbstractPollingEndpoint implementing MessageHandler DisposableBean and MessageSource<File>, which have been working with no particular problem for a few years.
Here is how i initialize the writer part:
And the corresponding configuration file:if (outputDirectory != null) {
relativePath = conf.getString(getName() + ".output.relative.path","");
filenamePattern = conf.getString(getName() + ".output.filename.pattern","");
ouputFile = new File(outputDirectory + "/" + Utils.now(relativePath));
if (!ouputFile.exists()) {
logger.debug("Creating directory " + ouputFile);
(new File(ouputFile.getPath())).mkdirs();
} else if (!ouputFile.canWrite()) {
logger.debug("Trying to set directory readable " + ouputFile);
(new File(ouputFile.getPath())).setWritable(true);
}
writer = new FileWritingMessageHandler(ouputFile.getAbsoluteFil e());
writer.setAutoCreateDirectory(true);
writer.setChannelResolver(ApplicationContextProvid er.getChannelRegistry());
writer.setBeanFactory(ApplicationContextProvider.g etApplicationContext());
writer.setRequiresReply(false);
String channel = BeansNormalizedNames.getCoreRouterInputChannel();
writer.setOutputChannel((MessageChannel) ApplicationContextProvider.getChannelRegistry().ge tChannel(channel));
writer.afterPropertiesSet();
logger.info("writing in " + ouputFile.getAbsolutePath());
}
Just tell me if this is not clear...USER_PLATE_XML_FILE_WRITER.type = FILE
USER_PLATE_XML_FILE_WRITER.trigger = 10000
USER_PLATE_XML_FILE_WRITER.messages.per.poll = 10
USER_PLATE_XML_FILE_WRITER.output.directory = C:/Users/max/Documents/AndromasTest/plates
USER_PLATE_XML_FILE_WRITER.output.relative.path = yyyy/MM/dd
Why are you not using <int-file:outbound-channel-adapter>? I mean why do you need custom component?
Oleg Zhurakousky
Spring Integration team
http://twitter.com/z_oleg
http://blog.springsource.com/author/ozhurakousky/
Because they can be dynamiccally instanciated at runtime.
Ok, since you are creating it yourself, would you be able to compile a test case that reproduces this issue and attach it to this forum and I'll take a look?
Oleg Zhurakousky
Spring Integration team
http://twitter.com/z_oleg
http://blog.springsource.com/author/ozhurakousky/
oh, it seems the .writing file is overwritten correctly, but not the original !
so, to sum up :
first time file created correctly with filename
second time, second file created called : filename.writing
then after : file filename.writing overwritten but original file never changes
thanks
Hi Oleg,
Please find an example of what i've described just in previous post.
Here is my spring integration XML file (at least the file writing part) :
Then in my code, when i send messages to this channel:Code:<bean id="toStringTransformer" class="org.springframework.integration.xml.transformer.ResultToStringTransformer" /> <integration:channel id="toDiskChannel"></integration:channel> <integration:channel id="testOutputChannel"></integration:channel> <si-xml:marshalling-transformer marshaller="testResultMessageMarshaller" output-channel="toDiskChannel" input-channel="testOutputChannel" result-transformer="toStringTransformer" /> <file:outbound-channel-adapter channel="toDiskChannel" directory="${test.output.directory}"> </file:outbound-channel-adapter>
The first is written correctly, and the following message with identical filename produce a .writing file, which is correctly overwritten then (with following messages) :Code:Message<GenericXMLMessageType> mess = MessageBuilder.withPayload(msg.getPayload()). copyHeaders(fileContents.getHeaders()). build(); MessageChannel channel2 = (MessageChannel)ApplicationContextProvider.getApplicationContext().getBean("testOutputChannel"); channel2.send(mess);
overwriteBug.png
Thank you very much
Max