On Tue, Jun 23, 2009 at 4:04 AM, Joe Gottman <josephgott...@comcast.net>wrote:
> > > > Claus Ibsen-2 wrote: > > > > On Thu, Jun 18, 2009 at 2:59 PM, Joe Gottman > > <josephgott...@comcast.net>wrote: > > > >> > >> Suppose I have a route that begins with something like > >> > >> from("file://c:\foo\bar") > >> > >> and I want to catch and handle any Exceptions thrown from this endpoint. > >> Is > >> there any way to do this? I can surround a subsequent "to" in a "doTry" > >> ... > >> "doCatch" block, but there doesn't seem to be any way to do this for the > >> "from" clause. Am I missing something, or is this a problem with the > >> DSL? > > > > > > Hi > > > > All the error handling in Camel such as onException, dead letter channel > > kicks in when an exchange is created and routed. > > So if an exception occurs beforehand such as inside the file consumer (eg > > a > > bug in Camel) then the component itself has a mechanism to handle that. > > > > > >> > >> -- > >> View this message in context: > >> > http://www.nabble.com/Catching-errors-from--%22from%22-endpoints-tp24092503p24092503.html > >> Sent from the Camel Development mailing list archive at Nabble.com. > >> > >> > > > > > > But a Producer, especially a polling Producer, can fail after it is > started. For instance, a file producer like > from("file://H:/foo") > > could fail because the network connection to the H: drive was lost. Is > there any way to set up the route to handle that? > No you can use the ErrorHandler on the Consumer to handle this exception. >From this ErrorHandler you can send a message to a route to let it handle it, however its not like a first class DSL error handling with the onException etc. As the DSL error handling is when an Exchange (= Message) have been created and then there is a failure when routing this message. The consumer on the other hand fails before an Exchange (= Message) have been created and thus the DSL error handling cannot be used here. The consumer is also scheduled so it will try again on next poll. > > -- > View this message in context: > http://www.nabble.com/Catching-errors-from--%22from%22-endpoints-tp24092503p24158601.html > Sent from the Camel Development mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus