Spring Integration - Move File After Xpath-splitter

i'm working with spring integration and i have the next case: i'm reading a XML file with an int-file:inbound-channel-adapter and i split the file with a int-xml:xpath-splitter, the thing is that i need to move the file after been splitted.

I want all features of int-xml:xpath-splitter plus moving the file, should i implement a custom splitter extending XPathMessageSplitter? or is there any other way to do that with an out-of-box components?


<int-xml:xpath-splitter id="salesTransSplitter" 
                   output-channel="splitterOutChannel" order="1">
    <int-xml:xpath-expression expression="/sales_transactions/trans"/>      


Something like this should work...

<int-file:inbound ... channel="foo" />

<int:publish-subscribe-channel id="foo" />

<int-xml:xpath-splitter input-channel="foo" ... order="1" />

<int-service-activator input-channel="foo" order="2"
      expression="payload.renameTo(new java.io.File('/newDir/' + payload.name)" output-channel="nullChannel" />

If you want to test the rename was successful, send to some other channel other than nullChannel - boolean true means success.


Sorry about that; order should be supported on every consuming endpoint, I will open a JIRA issue.

The order is not strictly necessary; if no order is present, the order they appear in the configuration will be used; I just prefer to make it explicit.

There are (at least) two work arounds:

  1. Remvoe the order attribute from BOTH consumers and they will be invoked in the order they appear in the XML.
  2. Configure the XPath splitter as a normal splitter, which does support order...

    <int:splitter id="salesTransSplitter" order="1"
               output-channel="splitterOutChannel" order="1">
        <bean class="org.springframework.integration.xml.splitter.XPathMessageSplitter">
            <constructor-arg value="/sales_transactions/trans" />

Need Your Help

Directory to save files in android?

android android-sdcard

According to my application, I'm downloading the pictures and some data and I need to save them somewhere in the phone memory or sd card. Since the pictures can be quite big, I decided to save it i...

print statements in dart-polymer UI not seen in webstorm console

dart webstorm dart-polymer

I have some print statements in a Dart UI app. Depending on the UI selection strings are printed to the console. Everything used to work as expected with with Dart with Eclipse plugin. Now I cannot...