Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jberet-camel reading only one file #140

Open
jyterrien opened this issue Feb 15, 2021 · 2 comments
Open

jberet-camel reading only one file #140

jyterrien opened this issue Feb 15, 2021 · 2 comments
Assignees

Comments

@jyterrien
Copy link

Hi
I'm trying to read ZIP file with jberet
M'y first step use a camelItemReader to copy remote file localy with camel-ftps component.

Just for test I'm use file to file with camel file reader and writer
<step id="simple.step1"> <chunk item-count="1"> <reader ref="camelItemReader"> <properties> <property name="beanType" value="java.io.InputStream" /> <property name="timeout" value="6000" /> <property name="endpoint" value="file:target/data/?preMove=.inprogress/&amp;move=../.done&amp;include=test.xml"/> </properties> </reader> <writer ref="camelItemWriter"> <properties> <property name="endpoint" value="file:target/in/?fileName=toto.xml" /> </properties> </writer> </chunk> </step>
It works but ...
I have a problem with the timeout property. With a short delay I'm not sure if the file was downloaded correctly (process aborted)
With a long wait time I'm sure which file to download but the process does not end when the first file is downloaded and if a second file is available it is also downloaded.
How do I download only one file and wait long enough to be sure that the download will not be interrupted?

Thank

@chengfang chengfang self-assigned this Feb 15, 2021
@chengfang
Copy link
Contributor

I'll take a look. It's been a while since I touched it last time.

@chengfang
Copy link
Contributor

item reader typically reads a series of data items (many files in your case). If you only want to read one single file from the source, you probably don't need batch processing. If you still want to use this item reader, you can extend CamelItemReader by adding a counter. Once the reader has read the specified number of items, the next readItem call will return null to signal the end of reading operation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants