How to aggregate files after producer created all files?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to aggregate files after producer created all files?

hakuseki
Hi

I have a route that creates up to ten different files in a directory and another route that zips all these files.

We see in some scenarios that the zipping is done BEFORE all files have been created. Ending up with two zip files, one with eight files and one with two files.
The zip-route uses a delay, a completionFromBatchConsumer and eagerCheckCompletion.

How can I chain these two routes together so the zipping is always run after all files have been created?

My producer route creates files using a multicast and several .to("direct://“).


Thx

M
Reply | Threaded
Open this post in threaded view
|

Re: How to aggregate files after producer created all files?

wyuan4
can you use some indicator to check if all the files are created or not. If
it is not true, you don't need to call another route in choice when
condition.

On Wed, Nov 13, 2019 at 8:45 AM Mikael Andersson Wigander <
[hidden email]> wrote:

> Hi
>
> I have a route that creates up to ten different files in a directory and
> another route that zips all these files.
>
> We see in some scenarios that the zipping is done BEFORE all files have
> been created. Ending up with two zip files, one with eight files and one
> with two files.
> The zip-route uses a delay, a completionFromBatchConsumer and
> eagerCheckCompletion.
>
> How can I chain these two routes together so the zipping is always run
> after all files have been created?
>
> My producer route creates files using a multicast and several
> .to("direct://“).
>
>
> Thx
>
> M



--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Weiquan Yuan
Located in Ottawa, Canada
Reply | Threaded
Open this post in threaded view
|

Re: How to aggregate files after producer created all files?

Mantas Gridinas
I suppose the solution would not be using the file component at all, but
rather agregating messages and using ZipOutputStream to convert those
messages into a zip file and only then to store it in the file system via
file component.

On Wed, Nov 13, 2019, 20:57 WEIQUAN YUAN <[hidden email]> wrote:

> can you use some indicator to check if all the files are created or not. If
> it is not true, you don't need to call another route in choice when
> condition.
>
> On Wed, Nov 13, 2019 at 8:45 AM Mikael Andersson Wigander <
> [hidden email]> wrote:
>
> > Hi
> >
> > I have a route that creates up to ten different files in a directory and
> > another route that zips all these files.
> >
> > We see in some scenarios that the zipping is done BEFORE all files have
> > been created. Ending up with two zip files, one with eight files and one
> > with two files.
> > The zip-route uses a delay, a completionFromBatchConsumer and
> > eagerCheckCompletion.
> >
> > How can I chain these two routes together so the zipping is always run
> > after all files have been created?
> >
> > My producer route creates files using a multicast and several
> > .to("direct://“).
> >
> >
> > Thx
> >
> > M
>
>
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Weiquan Yuan
> Located in Ottawa, Canada
>