Email notification for service errors

We’re using webMethods version 10.5 and configured email notification in Integration server–>Resources to get alert email in case of service exception, however it’s not returning parent service details. So, it’s hard to find which service is throwing exception out of 100 of flow service using addInt in this example. Is there anyway to get parent service details ?

Hi,

Don’t you have more information at server.log?
It is good practice to implement try/catch section in the flow code.
In the catch section use: pub.flow:getLastError that would return the error that cause the problem
Then you can use pub.flow:debugLog to store the error into server.log.

In that case it is easy to see what flow is having problems.

Regards,
Łukasz Konkol

Hi,

please remember that pub.flow:getLastError needs to be the first step in the catch block, otherwise the error informations is not available for further processing.

Regards,
Holger

Hi @surendra_Gollapudi ,
It appears that the message sent to the service email is not customizable.

Currently, I’m assuming that there are already hundreds of services without the try catch mechanism and modifying all of them is not an option. And you would like to find the service that is throwing this error.
If you have access to error logs/ service logs , you should be able to find the source of the error since the details of the services executed will be present in these logs.

-NP

Addendum:

With the service name stated in the logs you can do a “Find dependents” in Designer and you will find all these services which are invoking addInts.

You can check these invocations for missing map to num2.

Regards
Holger

Hi @Nagendra_Prasad_A_R - Thank you for your response. We have implemented try/catch mechanism in all of our flow services. We get getLastError error dump in email notification as you can see in screen shot attached above, but not the parent service details.

Thanks,
Surendra.

Hi Holger, Thank you for responding. I would like to know if it’s possible to get the main service details instead of checking dependants. addInt error is just an example I provided for simplification purpose. We’re not actually using it without providing input :slight_smile:

Thanks,
Surendra.

Most likely you are doing mapping from variable that is not populated and that throws exception.
If you’ve got try/catch section implemented - I’m not sure what is a problem to check more details at the server log …
As I understand (I’ve never used that functionality myself) notification just send email in case of error to notify you about the problem on the server. Checking where is the problem should be done by some error handling implementation that you should do on your own.
If you’ve got try/catch section it is not problem to check logs for more details …
Still - if you would see error - you would check logs to see which service was cause of it.

In other hand - in most of the companies I’ve been working - the companies has it owns error handling implemented. The error handling has been added to catch section (after getLastError) and would do exactly what you want. So in this case it could just send email with full description of the issue. That could be customized and could send all kind of information.
If you’ve got 50+ servers in PRD … it won’t be possible to check if from the notification that you are using :slight_smile:

Regards,
Łukasz Konkol

Can you please share a sample flow service to show the implementation of the TRY/CATCH and the getLastError as a screenshot perhaps , there might be some modifications to the services/constructs used that might help you?

Here it is:
image

Server log row from that service:
2021-09-28 09:36:02 BST [ISP.0090.0004E] Default._202109.Konki:serviceExample – java.lang.ArithmeticException: / by zero

Here the error is “handled” already in the Catch block. If you go MWS and look the execution up, you’ll see that your service shows “Completed”, though it failed at divideInts.

At the end of the Catch block (still within), add an Exit step, set it to exit from $flow and signal FAILURE, and map the actual error message from getLastError. Does this now show the parent service as failed, in the email notification?

Note - Adding this Exit step comes with certain changes in behavious; for example, if your service is directly invoked by a UI; the actual internal error message will show up on the UI.

KM

Hi @surendra_Gollapudi,

for the missing parameter issue, normally will happen when

  1. totally no data to map into num2 variable
  2. early dropping of the variable that map into num2 in a loop case

The things can be done is checking the server log to see any hint it happen in which services.
I not sure how is the services design, maybe 100 services at the end point to a common email service?
The another thing that can check is put savefiletopipeline service every end of the 100 services, test those services and check in the folder for the pipeline been saved.

Hope this may help you.

Thanks