cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CronJob Notification Email - on failure

Former Member
0 Likes
3,345

Hi,

How do we configure cronjob execution to send emails if the job fails i.e. Aborted or Error status?

I think hybris only sends email in case the job execution is successful.

Do we have to extend the default functionality?

Regards, Mandar

Accepted Solutions (0)

Answers (5)

Answers (5)

ravi_tavva
Associate
Associate
0 Likes

Hmm.. Let me get back to you.

ravi_tavva
Associate
Associate
0 Likes

No. It doesn't. You will need to configure it.

Former Member
0 Likes

any documentation how to do that?

Can you please help me with this.

ravi_tavva
Associate
Associate
Former Member
0 Likes

Page Not found!!

Former Member
0 Likes

Does hybris send an email notification on cronjob failure?

Former Member
0 Likes

Hi, you can create a scripting job using Groovy, and make it run every X minutes and check for the running jobs status. If it finds any issues, send out an e-mail.

Former Member
0 Likes

Hybris sends email for all the cases i.e. Success, Failure, Error, Unknown.
If you could see "sendEmail(CronJobResult cronJobResult)" method you will notice

 public void sendEmail(CronJobResult cronJobResult)
     throws EmailException
 ...
 if (getResult().getCode().equals(GeneratedCronJobConstants.Enumerations.CronJobResult.SUCCESS))
 {
   String subject = Config.getParameter(Config.Params.CRONJOB_MAIL_SUBJECT_SUCCESS);
   MailUtils.validateParameter(subject, Config.Params.CRONJOB_MAIL_SUBJECT_SUCCESS);
 }
 else
 {
   subject = Config.getParameter(Config.Params.CRONJOB_MAIL_SUBJECT_FAIL);
   MailUtils.validateParameter(subject, Config.Params.CRONJOB_MAIL_SUBJECT_FAIL);
 }
 ...
 }