Results 1 to 2 of 2

Thread: copying files to a different location after consuming

  1. #1

    Default copying files to a different location after consuming

    Hi Guys,

    I got a new requirement change for my project. earlier i was using the file inbound adapter and it periodically polled for messages. Once it consumes the message we kept the file as its in the same location. my new requirement is to delete the file from the original location and copy it to some other location, so client can easily figure it out what are the sent files. is there any way of copying files after consuming?


    Thanks,
    Kelumt

  2. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,017

    Default

    It's available using the transaction synchronization feature in 2.2...

    http://blog.springsource.org/2012/09...nchronization/

    together with a PseudoTransactionManager.

    2.2. should be released soon; it is currently at RC2.

    For 2.1, you would need to copy the File to a header using a header-enricher; then, at the end of the flow make the last channel a publish-subscribe-channel and add a second subscriber to the channel. Set the current subscriber order="1", then create a second subscriber...

    Code:
    <int:service-activator order="2" input-channel="lastChannel" 
        expression="headers['savedFile'].renameTo('/completed/' + headers['savedFile'].name" />
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

Tags for this Thread

Posting Permissions

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