6: CCM_Stacking

The process has this structure:

  • Timer body script, or the CCM_DoStacking script, which selects a customizable set of envelopes from the database and batches them into stacks by calling the Run function from the Stacking component. For more information on the Run function and the available configuration functions, see Run function in stacking and Stacking component functions.
  • Surrounding timer, which ensures that the CCM_DoStacking script is called at a particular time.

Loop body script

By default, CCM_DoStacking behaves as follows:

  • Selects all available envelopes at once
  • Batches all envelopes for the same printer in one stack
  • Does not sort the envelopes within a stack
  • Does not restrict the size of the created stacks

You can customize this behavior by editing the CCM_DoStacking script. To do so, add or change calls to the configuration functions provided by the Stacking component.

Surrounding timer

The surrounding timer runs the CCM_DoStacking script at a set interval. By default, the script is run once a day at 3 AM. The run stops if the process receives a Stop or Cancel signal, or if the CCM_DoStacking script throws an exception.

If the stacking script must run frequently at small intervals it shouldn't use a timer object. Instead it should use a loop that contains sleep statements for implementing the interval.

Error handling

After the CCM_DoStacking script ends, the surrounding timer calls it again at the next scheduled run.

It is only safe to run multiple stacking processes simultaneously if the envelopes that they select are disjointed; that is, they are guaranteed to select different envelopes from the database.