4: CCM_ElectronicDelivery

The process has this structure:

  1. Loop body script, or the CCM_DoElectronicDelivery script, which relies on the DeliverCommunication function of the ElectronicDelivery component for processing a single electronic communication. The order to process the communications is not determined. For more information on DeliverCommunication, see DeliverCommunication function (for electronic output).
  2. Surrounding loop, which ensures that the CCM_DoElectronicDelivery script is called repeatedly.

Loop body script

The CCM_DoElectronicDelivery script calls the DeliverCommunication function and monitors the result:

  • If an electronic communication is processed successfully, the script ends.
  • If no electronic communication 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 electronic communications are available, they are picked up one by one without delay. If no electronic communication 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_DoElectronicDelivery script throws an exception. As long as the CCM_ElectronicDelivery process is running, electronic communications are continuously distributed.

It is safe to run multiple electronic delivery processes simultaneously, even if they process communications from the same run-time database.