Hi,
Following is the sample code for camel configuration in spring dsl....
<camel:camelContext id="sampleContext">
<!-- Exception policy for Camel Infrastructure -->
<camel:onException>
<camel:exception>java.lang.Exception</camel:exception>
<camel:handled><camel:constant>true</camel:constant></camel:handled>
<!-- Set this header to raise alarm for exceptions -->
<camel:setHeader
headerName="raiseAlarm"><camel:constant>true</camel:constant></camel:setHeader>
<camel:process ref="edmErrorProcessor"/>
</camel:onException>
<!-- Define your routes here -->
<camel:route id="fileTransport" handleFault="true">
<camel:from uri="activemq:queue:test"/>
<camel:process ref="edmMessageProcessor"/>
<camel:to uri="
ftp://localhost:2121?username=admin;password=admin;fileName=pom.xml;throwExceptionOnConnectFailed=true"/>
<camel:log message="Processing ${header.CamelFileName}
file!!!"></camel:log>
<camel:to
uri="file:///home/ebijcha/Documents/Camel_Work_Dir/FTP_Inbox"/>
</camel:route>
</camel:camelContext>
Regards,
Bijoy
On Thu, Jan 9, 2014 at 12:26 PM, Bijoy Chaudhury
<[email protected]>wrote:
> Hi,
>
> I'm planning to design an application which can receive files from
> multiple transports like JMS, FTP, FILE, REST etc. I'm having trouble to
> handle the ConnectException thrown at route startup if any endpoint(JMS,FTP
> etc.) is down.
>
> I have designed a global exception handler using onException which is able
> to handle the exceptions once the route is started. Consider following
> scenarios...
>
> 1) Suppose we have a route FILE --> JMS --> Process --> FTP.If FILE
> consumer is trying to send a file to JMS and JMS server is down then
> ConnectException is thrown and handled by global exception handler. But if
> there is no file to consume for FILE consumer and JMS server goes down then
> ConnectException is thrown by activemq(the broker I used) but this
> exception is not handled by exception handler.
>
> 2) Now if we have a route JMS --> FILE --> Process --> FTP. If the JMS
> server is down while trying to start the route we get ConnectException
> which is not handled by global exception handler.
>
> After exploring some discussion threads I understood to handle such
> ConnectException we need have exception listeners or need to do some socket
> programing for individual components. But I don't want to create exception
> listeners for individual component. Instead is there any way to globally
> handle such ConnectException be it thrown by JMS, FTP or REST or by any
> other network component?
>
> Thanks for short feedback!
>
> Regards,
> Bijoy
>
--
View this message in context:
http://camel.465427.n5.nabble.com/Re-Handling-ConnectException-at-route-startup-tp5745765.html
Sent from the Camel - Users mailing list archive at Nabble.com.