Then you can try the custom pollStrategy.
On 21 Jun 2017 10:57, "Artur Jablonski" <ajablon...@ravenpack.com> wrote: > Hello! > > Thanks for the hint > > So that works... kind of. > > First, with timeout(0) it doesn't work, it won't even try to poll for > anything. I suppose that's how it's supposed to work. Fine. > > With timeout(>0) it works, as in it gives up after the given number of > milliseconds and null is propagated down the route where I can > catch it in choice() and only process further those not null responses. > > This seems to me a bit brittle. I mean setting this timeout too low, could > potentially make me miss an existing file if some network glitch happened > that would slow down the request-response cycle, and setting it high seems > like a waste when the AWS-S3 Consumer throws an exception that clearly > tells me that file that I want doesn't exist. > > So what I am looking for, I guess, is exception handling mechanism for > Consumer, so that I can break polling on given exception. > > I looked here http://camel.apache.org/polling-consumer.html > and was looking at backoffErrorThreshold, backoffIdleThreshold and > backoffMultiplier as the only properties that mention error handling, but I > guess they're not for what I want. > > Am i missing something? > > Cheers > Artur > > > On Wed, Jun 21, 2017 at 6:26 AM, Taariq Levack <taar...@gmail.com> wrote: > > > You can use a timeout of 0 for receiving with no wait, or greater than 0 > > for waiting a bit. > > Default is -1 > > > > http://camel.apache.org/content-enricher.html > > > > Cheers, > > Taariq > > > > On 20 Jun 2017 22:12, "Artur Jablonski" <ajablon...@ravenpack.com> > wrote: > > > > > 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 > > > >> > > > > > > > > > > > > > >