Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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).
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.
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
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"
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
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).
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.
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.
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 ?