Just had a thought - couldn't I use the file component as a batch consumer,
then know when it had consumed all of the files and trigger my cleanup code
based on that, then have that trigger the shutdown?

Not at my computer at the moment, I'll have to try it in the morning.

Larry
On Feb 6, 2012 4:22 PM, "Larry Meadors" <larry.mead...@gmail.com> wrote:

> Wow, this thread is growing and what I thought was a simple task is
> turning into a bit of a mess. :-/
>
> Here's what I'm trying to accomplish:
>  - I have a directory with files in it
>  - I want to process every file in that directory
>  - Once I have processed *all* of the files, I want my app to execute
> some cleanup code and then shut down
>
> The original issue was that when I started up the app, it shut down
> immediately and didn't process any files...so I changed my code to use
> the Main class to keep it running until it was done.
>
> That worked, but then it wouldn't *stop* and I couldn't run my cleanup
> code.
>
> It processed all the files, but stayed running...so I added the
> shutdown thing in an onCompletion block, thinking (erroneously) that
> the onCompletion code would run at the end after ALL files were
> processed.
>
> Now I see that the code in onCompletion() is running after every file
> is processed...so it gets one or two files, then shuts down. Which
> looks like the expected behavior, now that I'm re-reading that section
> in the CIA book.
>
> Can someone point me to an example that shows how to do what I'm
> trying to do here?
>
> The issue seems to be knowing when I'm done (all the files have been
> consumed). Is there a way to do that? Is it documented anywhere?
>
> Does sendEmptyMessageWhenIdle=true mean that it'll send a null message
> after processing all of the files or only if there are no files when
> it starts?
>
> Larry
>

Reply via email to