Thanks Karen,
It is helpful info which i will re-try again.
i have another workaround for such case for now.
Thanks for chasing it up though.
Appreciated.

Cheers
Onder

On Tue, Aug 10, 2021 at 10:04 PM Karen Lease <karenlease...@gmail.com>
wrote:

> Hi Onder,
> I reproduced this issue with the current trunk too.
>
>
> Ihe issue is caused by the "sendEmptyMessageWhenIdle=true" option on the
> file consumer. That causes an exchange with an empty body to be queued
> which isn't read. When there is a file available, a new exchange is
> queued with the file contents but the previously queued empty message is
> returned. If a second file is put in the folder and the rest endpoint is
> triggered again, the previously queued file is returned.
>
> The workaround is to remove the sendEmptyMessageWhenIdle option or set
> it to false, and set a timeout (0 will work) on the pollEnrich. Then
> your route works as you expect since when no file is available the file
> consumer returns no result and the enricher sends an empty body.
>
> Hope this helps,
> Karen
>
>
> On 05/08/2021 13:48, Onder SEZGIN wrote:
> > extra info:
> >
> > it keeps logging No files found.. skipping to send to S3
> > which possibly means that file is not getting picked up.
> > and
> > camel version is 3.7.5
> >
> > thanks
> >
> > On Thu, Aug 5, 2021 at 12:17 PM Onder SEZGIN <ondersez...@gmail.com>
> wrote:
> >
> >> Hello,
> >>
> >> After a while i am taking a ride with newer versions of camel, and i
> have
> >> a usecase to create a restful endpoint which will trigger uploading a
> file
> >> from a preconfigured directory to s3 bucket.
> >>
> >> so below if we endpoint is called and there is no file in the directory
> it
> >> logs nothing to upload but later if i place a file under the directory
> and
> >> make an api call to upload endpoint again, it does not pick up the file?
> >>
> >> Any idea is appreciated, i kind of doubt about default aggregation part
> of
> >> pollEnrich pattern but i am not sure.
> >>
> >> Thanks
> >> Onder
> >>
> >> rest()
> >>          .path("/v1/upload")
> >>          .consumes("application/json")
> >>          .produces("application/text")
> >>          .post()
> >>          .type(Void.class)
> >>          .to("direct:uploadFiles");
> >>
> >> from("direct:uploadFiles")
> >>
> .pollEnrich("file:{{shared-folder}}?include=.*.gz&delete=true&sendEmptyMessageWhenIdle=true")
> >>          .choice()
> >>            .when(body().isNull()).log("No files found.. skipping to
> send to S3")
> >>            .otherwise().to("direct:toAwsS3")
> >>          .endChoice();
> >>
> >>
> >
>

Reply via email to