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

Overwrite jalo job

Former Member
0 Kudos
306

Hello,

I want to send a email only in case cronjob failure,

So I am trying to overwrite public function sendEmail in CronJob.class to write my code but my new class is ignored

CronJob.class is in package de.hybris.platform.cronjob.jalo and I am using hybris 5.7

Thank you in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

mpern
Product and Topic Expert
Product and Topic Expert
0 Kudos

You could try injection your custom implementation like this:

 <bean id="de.hybris.platform.cronjob.jalo.CronJob" class="myPackage.jalo.CustomCronjob" scope="prototype" /> 

Source: Spring in the hybris Multichannel Suite - Prior to 4.3.0 (This still works, even for 1808!)

But be aware that the Cronjob class is the base class for various other, older platform jobs, and those will still use the old implementation.

If injecting the class doesn't work for your use case, try to intercept the Cronjob.sendEmail method using AOP. Start first with Spring AOP, and if that doesn't work, use load-time weaving with AspectJ.

Both approaches are explained here: Spring AOP in SAP Hybris Commerce