Develop > Business logic > Name-value pair command framework > Command types > Controller command programming model


Long-running controller commands

If a controller command takes a long time to execute, you can split the command into two commands. The first command, which is executed as the result of a URL request, simply adds the second command to the Scheduler, so that it runs as a background job.

The flow shown in the preceding diagram is...

  1. ControllerCommand1 is executed as a result of a URL request.

  2. ControllerCommand1 adds a job to the Scheduler. The job is ControllerCommand2. ControllerCommand1 returns a view, immediately after adding the job to the Scheduler.

  3. The Scheduler executes ControllerCommand2 as a background job.

In this scenario, the client typically polls the result from ControllerCommand2. ControllerCommand2 should write the job state to the database.


Related concepts

Command types

Controller command programming model


Related tasks

Customize existing controller commands


+

Search Tips   |   Advanced Search