Application Development53% of the exam

Custom job steps: task and chunk modules

How to build a custom job step type: register it in steptypes.json, choose a task-oriented or chunk-oriented CommonJS module, control the exit status, read step parameters, keep transactions and memory in check, and configure the job's schedule and resource locks in Business Manager.

Official exam objective
Given a business requirement to perform a scheduled task, develop jobs and code job scripts.

~8 min read · 13 practice questions ·

What the exam expects

  • Create a custom job step type: CommonJS module, steptypes.json in the cartridge root, cartridge on the path.
  • Choose a task-oriented or chunk-oriented module and implement its required functions.
  • Predict a step's status code, error flag and whether the job continues from what the module returns or throws.
  • Read step parameters in code and set step type attributes such as transactional and timeout-in-seconds.
  • Configure the job in Business Manager (schedule, flows, resource locks) and write job code that scales.

Key terms: step type (a reusable step definition registered by a steptypes file); task-oriented module (one function runs the whole step); chunk-oriented module (read, process and write items in chunks of a set size); exit status (the dw.system.Status code and error flag the framework records for a step); job resource (an object a job locks while it runs).

Key facts

steptypes file location
Detail
Cartridge root; one per cartridge
@type-id prefix
Detail
Must begin with custom.
Duplicate @type-id on the path
Detail
The step isn't loaded
Missing function
Detail
Module must export execute
Chunk required functions
Detail
read, process, write; chunk-size required
process returns nothing
Detail
Item is filtered from the write list
Chunk exit status
Detail
Always OK or ERROR
Error status with custom code
Detail
Code replaced with ERROR; job stops
transactional default
Detail
false
timeout-in-seconds
Detail
No default; setting one is recommended
Read a parameter
Detail
parameters.Name or stepExecution.getParameterValue('Name')
Prevent concurrent changes
Detail
Add the changed objects on the job's Resources tab
ImportCatalog / ExportOrders context
Detail
Organization / Sites; ExportOrders takes at most 1000 orders per run
Sources for this section (5)
  • Why give a chunk module a getTotalCount function?
  • When one cartridge's steptypes.json has a syntax error, what happens to other cartridges' step types?
  • Which names can a @type-id never take, apart from duplicates?
  • When should a recurring job's start date be set in the past?

The questions are free to read. Answers with their sources and self-grading are included with the pack.

Keep reading with the B2C Commerce Developer pack

  • Core concepts
  • Exam traps
  • Worked scenario

The pack includes:

  • All 28 lessons of the B2C Commerce Developer guide, with reading progress
  • Interactive decision walks and step-by-step sequence steppers
  • Practice exams purchase adds inline bank questions and topic practice (13 questions for this lesson)
  • An official source cited for every claim
  • An AI tutor that answers from the guide
  • Choose guide-only, practice-only, or save $4 with both

Practice for the B2C Commerce Developer exam