9: CCM_Distribution

The process has this structure:

  1. Loop body script, or the CCM_DoDistribution script, which relies on the DistributeStack function of the Distribution component for processing a single stack. The order to process stacks is not determined. For more information on the DistributeStack function, see DistributeStack function.
  2. Surrounding loop, which ensures that the CCM_DoDistribution script is called repeatedly.

Loop body script

The CCM_DoDistribution script calls the DistributeStack function and monitors the result:

  • If a stack is processed successfully, the script ends.
  • If no stack is found, the script waits five seconds, and then ends.
  • If an exception marked as Handled is thrown, the script ends.
  • If an exception is thrown that is not marked as Handled, the script throws an exception.

When the script ends normally, the surrounding loop immediately calls the script again. Therefore, as long as stacks are available for distribution, they are picked up one by one without delay. If no stack is available, the next check is delayed for five seconds.

Surrounding loop

The surrounding loop continues indefinitely until the process receives a Stop or Cancel signal, or the CCM_DoDistribution script throws an exception. As long as the CCM_Distribution process is running, stacks are continuously distributed.

It is safe to run multiple distribution processes simultaneously, even if they distribute stacks from the same run-time database.