Question & Answer
Question
How to implement a custom cron job
Answer
The custom cron jobs should be implemented by extending the ApplicationCron (for Application Cron jobs) and overriding the Service method.
The service method should not have any business logic and should only be used only to call message type (MT). The business logic should go into the bizlets mapped to the MTs.
Also the cron job uses the bizlet session to carry out authentication and other storefront related properties.
If the business logic is used in the Service method directly and no MTs are called, then this can lead to unknown behavior. Few known issues that a user can face are:
-- The user authentication is not done when the cron job is triggered.
-- When cron job is triggered automatically the user session is null and none of the storefront properties are picked up.
-- When cron job is triggered manually the user session of the login user is used to process the cron job.
Historical Number
HTG3198
Was this topic helpful?
Document Information
Modified date:
16 June 2018
UID
swg21561986