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

What is difference b\w Job and AbstractJobPerformable in Cronjobs ?

Former Member
0 Likes
890

Hello Experts,

What is difference b\w Job vs AbstractJobPerformable in Cronjobs? When we will go with JobModel or AbstractJobPerformable.

Thanks,

Accepted Solutions (0)

Answers (1)

Answers (1)

arvind-kumar_avinash
Active Contributor
0 Likes

The class extending AbstractJobPerformable (which implements JobPerformable) contains the logic to be executed when a CronJob runs. During the phase of essential data creation, for each Spring definition of a class implementing the JobPerformable, a ServicelayerJob instance gets created and the springId attribute of ServicelayerJob is set to reference the Spring bean. Given below is the definition of ServicelayerJob:

 <itemtype code="ServicelayerJob"
           extends="Job"
           jaloclass="de.hybris.platform.servicelayer.internal.jalo.ServicelayerJob"
           autocreate="true"
           generate="true">
     <attributes>
         <attribute qualifier="springId" type="java.lang.String" autocreate="true">
             <persistence type="property"/>
             <modifiers read="true" write="true" search="true" initial="true" optional="false"/>
         </attribute>
         <attribute qualifier="springIdCronJobFactory" type="java.lang.String" autocreate="true">
             <persistence type="property"/>
             <modifiers read="true" write="true" search="true" initial="true" optional="true"/>
         </attribute>
     </attributes>
 </itemtype>

In summary, the CronJob executes the logic contained in the class extending AbstractJobPerformable through the reference ( springId) provided by ServicelayerJob( which extends Job ) .

Note: The id of the Spring bean (extending AbstractJobPerformable) is set to the code attribute as well (in addition to the springId attribute). You can execute SELECT * FROM {ServicelayerJob} FS Query to check this.

You can also check my another answer, https://answers.sap.com/questions/12771589/cronjob-creation.html?childToView=12805403#answer-1280540... on this topic.