Cert++
Close

Task-oriented versus chunk-oriented custom job step modules

Key Takeaway

Use a task-oriented module for one task with no clear progress measure, and a chunk-oriented module for a countable set of items. Only a task-oriented step can set its own exit status, by returning a dw.system.Status that can carry a custom status code. A chunk-oriented step always finishes with either OK or ERROR.

A custom job step lets a scheduled B2C Commerce job run your own code when no system step does what you need. You write that code as a CommonJS script module in one of two styles. In a task-oriented module, the job framework calls one main function. In a chunk-oriented module, the framework reads, processes, and writes a list of items in fixed-size batches. The right style depends on whether the work is one task with no clear progress measure or a countable set of items.

Task-oriented and chunk-oriented modules

Both styles are CommonJS script modules. They differ in how the job framework calls your code, so each style fits a different kind of work.

Task-orientedChunk-oriented
How it runsExposes one function, which the framework calls as the step's main functionReads, processes, and writes items in chunks of a defined size
Works best forA single task where progress can't be calculated or the boundaries are hard to calculateCountable data where the boundaries can be quickly calculated or are fixed
ExampleConnecting to an FTP server and downloading a fileExporting a list of orders or products to a file

A chunk can run any series of processing steps, not just database transactions.

Chunk-oriented steps can't be built with a pipeline module. Pipeline modules are legacy and should be migrated to CommonJS script modules.

B2C Commerce Developer Study Guide

Checklist progress

0/237Learned

Prepare for the Exam

Play Today's Certle

Study Community

Ask questions and get the latest info from other B2C Commerce Developer studiers.