Results 1 to 10 of 15

Thread: File adapter in APPEND mode doesn't work.

Threaded View

  1. #1
    Join Date
    Oct 2012
    Posts
    10

    Default File adapter in APPEND mode doesn't work.

    Hi,

    I'm using newest Spring Integration 2.2.0.RELEASE and trying to write to file in APPEND mode. I generate message as following:

    Code:
    	private void generateMessagesFromFolder(File folder, String channelToSend) {
    		MessageChannel channel = (MessageChannel) context.getBean(channelToSend);
    		
    		for (File file : folder.listFiles()) {
    			Message<File> msg = MessageBuilder.withPayload(file)
    					.build();
    			
    			channel.send(msg);
    		}
    	}
    File adapter is configures as following:
    Code:
     <int-file:outbound-channel-adapter id="eventsExport" 
     	channel="EventsExportChannel"
     	directory="file:C:/Test/Export"
     	mode="APPEND" />
    Files are XML, therefore, before sending to the adapter, I do some pretty simple XSLT transformation.

    Code:
     <int:chain input-channel="PreExportChannel" output-channel="EventsExportChannel">
       <int-file:file-to-string-transformer delete-files="true" />
       <int-xml:xslt-transformer xsl-resource="EventToCSV.xsl" />
     </int:chain>
    When I do the same without APPEND mode, everything works fine, except that the result file contains only the info from the last message. I checked with debugger and the error seems to be raised by the attempt to get file lock.
    What am I doing wrong?

    As a side question: I also tried to workaround the problem with Aggregator (which I put as the last step in the chaing), therefore procuding the message with mannually set correlationId, sequence size and number, but didn't succeed, since my aggregate method never got called, resulting in TargetInvocationException.

    Any help is much appreciated!
    Last edited by maxvor; Jan 21st, 2013 at 10:54 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •