Right, that almost works.

Now the problem I have is that when a file I ask for doesn't exist the
consumer seems to be polling for it indefinitely. Is there a way of saying:
hey polling consumer, try n times and then give up. Throw an error or
return null. Don't insist, please.

Cheers
Artur

On 20 Jun 2017 9:55 a.m., "Artur Jablonski" <ajablon...@ravenpack.com>
wrote:

> Thank you so much Gregor!
>
> You pushed me in the right direction. I initially wrote a patch for S3
> producer to get me what I wanted, but after seeing your reply I read about
> the content enricher pattern and pollEnrich() in Camel.
>
> This SO was helpful as well
> https://stackoverflow.com/questions/36948005/how-do-
> dynamic-from-endpoints-and-exchanges-work-in-camel
>
> In the end, with this route:
>
> from("direct:pollEnrich").routeId("pollEnrich")
>                             .pollEnrich()
>                             
> .simple("aws-s3://{{buckets.mybucket}}?amazonS3Client=#amazonS3Client&deleteAfterRead=false&fileName=${in.header.CamelAwsS3Key}")
>                             .convertBodyTo(byte[].class)
>                             .to("bean:unmarshall")
>
>
> I can now poke the route and set the CamelAWSS3Key header to the file I
> want.
>
> Cheerio!
> Artur
>
>
> On Mon, Jun 19, 2017 at 10:43 PM, Gregor Zurowski <
> gre...@list.zurowski.org> wrote:
>
>> Hi Artur,
>>
>> You should be able to get a single S3 object with the camel-aws
>> component using the "fileName" query parameter on the consumer.  See
>> the documentation at
>> https://github.com/apache/camel/blob/master/components/camel
>> -aws/src/main/docs/aws-s3-component.adoc.
>>
>> Gregor
>>
>> On Mon, Jun 19, 2017 at 5:28 PM, Artur Jablonski
>> <ajablon...@ravenpack.com> wrote:
>> > Hello,
>> >
>> > I am trying to get a single object from S3 via Camel and I am not sure
>> how
>> > to do this.
>> >
>> > It seems that the producer endpoint can only upload to S3 and the
>> consumer
>> > endpoint can poll a bucket, but how can express a use case of
>> retrieving a
>> > single S3 object when I know it's key?
>> >
>> > Best
>> > Artur
>>
>
>

Reply via email to