On Fri, Feb 24, 2012 at 9:12 PM, tkatva <tuomas.ka...@gmail.com> wrote:
> Hi Claus
>
> Thank you for your responses... My concern is that I want polling
> FTP/FTPS/SFTP/FILE-endpoints to call my custom code if error occurs... Can
> you point me to a example where I can see how I can apply this
> pollingStrategy to these endpoints ?
>
> I am constructing endpoints programmatically and creating url's based on
> values received from database. Here is part of my code:
>
> RouteDefinition routeDef = new RouteDefinition();
>
> //Endpoint url constructed from values from db
> org.apache.camel.Endpoint fromEnd = camel.getEndpoint(fromUrl);
>
> routeDef.from(fromEnd);
>
> //Add "to" endpoints which are constructed the same way
> routeDef.to(toEndpoints);
>
> Then route is added to CamelContext and started later.
>
> If you could show example how I could add pollingStrategy to
> "fromEnd"-endpoint, you would save my week or maybe whole month ... :)
>

You would need to register your custom poll strategy in the registry.
If you use Spring XML then its a <bean> tag.
If you use standalone Java, then you may want to use the
SimpleRegistry with CamelContext and add it to this strategy from java
code.

Then in the endpoint uri, you just refer to the id of your custom poll
strategy using #id

file:foo?pollStrategy=#myPollStrategy

If you use Spring XML then

<bean id="myPollStrategy" class="com.foo.MyPollStrategyImplementation"/>




> Thank you
>
> Best Regards Tuomas Katva
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Endpoint-exception-handling-tp5504378p5513828.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to