Announcement Announcement Module
Collapse
No announcement yet.
copying files to a different location after consuming Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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" />

    Comment

    Working...
    X