Hi

You can use a file filter where you check the file if you have permission
to delete the file, that way you can control if you want Camel to
consume the file or not.


On Fri, Aug 18, 2023 at 5:56 PM Petr Kuzel <petrku...@eurofins.com.invalid>
wrote:

> Experiments show that extending process strategy is a thorny path,
> the component has a factory that creates a strategy
> according to move, moveFailed, preMove, noop, delete
> params. While creating subclass I could reverse
> engineer and inline for my set of parameters but even
> then I lack the params for locking strategy, I could reverse
> engineer and inline but it snow-balls too much, exposing internals.
>
> So stepping back a bit, for a simple file component
> if &move= fails because there is no permission
> to delete file, is there a plugin that would allow
> customized handling (a callback with ex, file
> and endpoint/consumer params).
>
> Use case is simple: if an input file cannot be deleted
> it reappears for consumption again and again
> so I prefer to stop such consumer (ringing
> some bells and leaving diagnostical data in logs).
> Idempotent pattern would just mask the root cause.
>
> I could contribute RFE if I'm not the only one
> that thinks the case deserves some core-level
> enhancements.
>
>   Best regards
>   Cc.
>
> --
>   Mr. Petr Kužel, Software Engineer
>   Eurofins International Support Services s.à r.l.
>   Val Fleuri 23
>   L-1526 LUXEMBOURG
>
> -----Original Message-----
> From: Petr Kuzel <petrku...@eurofins.com.INVALID>
> Sent: Friday, August 18, 2023 16:06
> To: users@camel.apache.org
> Subject: RE: How to handle an exception in completion while executing
> &move=
>
> Thank you for the hint, I've checked, I have luck, the component
> I use has a public process strategy, so I can subclass it.
>
> I'd revert back if a new problem blocks this approach.
>
> BTW It suggests that the components should have their default
> process strategy declared as public and documented ...
> unless there was a decoupling trick allowing to wrap
> an unknown/private impl of GenericFileProcessStrategy.
>
>   Regards
>   Cc.
>
> --
>   Mr. Petr Kužel, Software Engineer
>   Eurofins International Support Services s.à r.l.
>   Val Fleuri 23
>   L-1526 LUXEMBOURG
>
> -----Original Message-----
> From: Claus Ibsen <claus.ib...@gmail.com>
> Sent: Friday, August 18, 2023 13:18
> To: users@camel.apache.org
> Subject: Re: How to handle an exception in completion while executing
> &move=
>
>
>
> CAUTION: EXTERNAL EMAIL - Sent from an email domain that is not formally
> trusted by Eurofins.
>
> Do not click on links or open attachments unless you recognise the sender
> and are certain that the content is safe.
>
> Hi
>
> Maybe plugin your custom process strategy on the file component and handle
> the exception there, you can extend the default process strategy.
>
>
>
> On Wed, Aug 16, 2023 at 3:58 PM Petr Kuzel <petrku...@eurofins.com
> .invalid>
> wrote:
>
> > Hi Camel community,
> >
> > I have a case where a route with a remote file-based endpoint polls
> > a file message, processes it but in the
> > GenericFileProcessStrategy<T>.onComplete
> > state an implementation of &move= throws an exception caused
> > by missing delete/write permission.
> >
> > On next polling the same file is polled again …
> >
> > I need to have a possibility to break the loop. My plan,
> > if I had the exception at my custom handler, is to detect
> > if the exception is caused by a missing permission
> > and if so  stopping the route, incrementing an error
> > counter and logging a severe message.
> >
> > What error handler / callback is best for handling
> > exceptions in &move=, and &moveFailed=,
> > implementations, please?
> >
> > (I have a component user hat on my head. If I was
> > a component author, I’d consider if necessary permission
> > could be probed earlier and signaling e.g. polling
> > strategy failed() or so.)
> >
> >   Best regards
> >   Cc.
> >
> > --
> >   Mr. Petr Kužel, Software Engineer
> >   Eurofins International Support Services s.à r.l.
> >   Val Fleuri 23
> >   L-1526 LUXEMBOURG
> >
> >
>
> --
> Claus Ibsen
> -----------------
> @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


-- 
Claus Ibsen
-----------------
@davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to