Search code examples
javaspringspring-integrationspring-xd

file as source as well as sink in spring XD


I want to use file as source and sink in my spring XD stream definition. My use case is to read a large file and split it as more small files. I want to do this with stream definitions instead of going for a custom module

Stream definition i have written is

stream create inputStream8 --definition "file --dir=C:/springXD/ds_data --outputType=text/plain | splitter --expression=T(java.util.Arrays).copyOfRange(payload.split('\\n'),1,3) | file " --deploy

I am getting a error like

Label file should be unique but module file is at position 0 and position 2.

ANy suggestion how to label those modules ?

Any other way to split large without custom module?


Solution

  • See the documentation about labels.

    Labels are especially useful (and required) for disambiguating when multiple modules of the same name are used:

    file | ... | outfile: file ...