Develop > SMIS > Developing an Integration Template > Develope a custom controller

Develop a custom controller

A controller controls interactions between the manager, source and destination adapters, mapping function, and task manager of a schedule-based integration.

Note UI-based integrations do not need a controller.

SMIS provides a default controller. The following figure shows the workflow of the default controller. If this default workflow does not suit your integration, develop a custom controller.

Workflow of the Default Controller

When developing a custom controller, you can refer to smis_Controller in the Service Manager script library.

The typical workflow of a controller is as follows:

  1. Call the manager to do the following to prepare tasks:
    1. Delegate its source adapter to retrieve data from the endpoint;
    2. Wrap the data as tasks;
    3. Pass the tasks to the taskManager to save to the failover queue.
  2. Read all the tasks from the failover queue.
  3. Pass the data in the task to the mapping function for validation.
  4. If the data passes validation, get the destRecord (which is the result of value mapping) from the mapping function.
  5. Call the manager to preprocess and prepare the following:
    • The destObject (which is the target to save or update) ;
    • The action (for example, add/save/delete) that the manager should perform to process the destObject.
  6. Call the mapping function to process the destObject. All the final mapped values by the final mapping are set to the destObject.
  7. Call the manager to process the final destObject, and to return the result (success or failure).
  8. If the result is success, remove the task from the failover queue; If the result is failure, increase the retry count and update it to the failover queue.
  9. Call the manager’s postprocess and finalize functions to do cleaning.

Normally, you do not need to create a custom controller. You can leave some processes empty if you do nothing in them. In some cases, you may not need a mapping function and failover queue, so you can create a simple controller.