Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
ravi999
Contributor III
Contributor III

Capture all exceptions in ESB route

Hi All, 

 

We are able to send general email using cMail component.But how to send emails for all exceptions in ESB route? I have seen the cOnexception. But not sure what all exceptions(like java.lang.Exception) needs to be added in advanced setting so that all errors can be captured so that email notification can be sent. 

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable

I've also noticed that you errors are fundamental flaws with your Route. Your route cannot run with those errors. Can you create a route with an intermittent divide by 0 error (or similar)? Something like a cTimer--->cProcessor (with the divide by 0 error) and your cOnException process.

 

I don't believe the the cOnException component will work very well with fundamental route issues. I believe it will work better for intermittent data errors (in Beans, etc).

View solution in original post

10 Replies
Anonymous
Not applicable

java.lang.Exception should catch all Exceptions for you. If you want to catch absolutely anything that could be thrown by the Route, you could try using java.lang.Throwable. I've not actually tried this myself, but it should work.

ravi999
Contributor III
Contributor III
Author

No luck. I tried keeping java.lang.Throwable and tried keeping other exceptions in the pic in advanced setting. Here are the errors I generated which are not captured. Not sure if my approach is correct.

Failed to create Producer for endpoint: 

org.apache.kafka.common.KafkaException: Failed to construct kafka producer

java.io.FileNotFoundException etc

0683p000009M0EM.png

0683p000009M0hw.png


2018-10-28 14_55_50-Amazon WorkSpaces.png
Anonymous
Not applicable

You need to "Handle the Exceptions" to enable this I believe. Unfortunately I cannot test this on my machine at the moment as I don't have ESB on here. But on looking at your screenshot, you have "None" selected for the "Exception Behaviour"

ravi999
Contributor III
Contributor III
Author

I tried by keeping the handle exception as well.
Anonymous
Not applicable

What happens when you do that? I am suspicious as to whether the cMail is causing some confusion here. Maybe temporarily replace it with a cProcessor and a simple System.out

Anonymous
Not applicable

I've also noticed that you errors are fundamental flaws with your Route. Your route cannot run with those errors. Can you create a route with an intermittent divide by 0 error (or similar)? Something like a cTimer--->cProcessor (with the divide by 0 error) and your cOnException process.

 

I don't believe the the cOnException component will work very well with fundamental route issues. I believe it will work better for intermittent data errors (in Beans, etc).

ravi999
Contributor III
Contributor III
Author

I assumed cOnexception works like tlogcatcher in DI where it captures some of the errors like Table not found. The solution u suggested to keep 4/0 triggered the cOnexception. But I have one observation, I have the below 3 statements in cprocessor. In this case, 2nd statement threw exception and  the 3rd statement is not executed. As soon as there is exception, cOnexception is getting triggered and remaining statements in cprocessor are not getting executed. I observed the sme case with ignore exceptions, handle exceptions , none in conexception component. Is there a way to ignore the exception , keep the route running for next messages and to get email notification for exception so that prod support team can look into the exceptions.

0683p000009M0fm.png

0683p000009M0gV.png

Anonymous
Not applicable

I think you have to treat exceptions like you would in a Java try/catch block. As soon as you get an exception within the same try/catch (a single component would behave like this), the catch is initiated and the flow is changed.

ravi999
Contributor III
Contributor III
Author

So in that case. As soon as we get a error, exception will be activated and we get email regarding the exception. Next messages in the queue will not processed. Is there any way to ignore the exception and keep updates flowing, send email in case as soon as the exception is identified ?