Description

RTI_TASK_SUBMIT creates and optionally launches a background task. It is a member of the RTI_TASK_xxx programs. Use RTI_TASK_SUBMIT to trigger a background task from a program.

RTI_TASK_SUBMIT allows you to launch tasks which require the presentation server, for example OIPI reports. It can be configured to start up an additional OpenInsight for each requested task, or to maintain a “background queue” of OpenInsight invocations that can be used to process requests in the order they are submitted.

[See RTI_TASK_SCHEDULER for the case where you to create a task triggered by time.]

Syntax

Rslt = RTI_TASK_SUBMIT(callType, funcName {,<param1>} {,<param2>}… {,<param10>})

Parameters

The function has the following parameters:

ParameterDescription
callType

There are three possible values:

ValueDescription
ValueDescription
nullLaunch immediately
0Add task to the queue
1Add to the queue, launch a poller to process the queue
funcNameThe name of the fuction or subroutine to execute.
taskdetailsAn @FM delimited array containing the information to place into the Task Scheduler for the specific job. Used with the ADD tasktype only.
{,<param1>}, {,<param2>}...{,<param10>}The arguments for the function. RTI_TASK_SUBMIT supports functions with up to ten arguments.

Returns

The “task ID” of the newly submitted task. The TaskID will be used to query the background processor about the status of the request, and retrieve any generated results, with the RTI_TASK_STATUS call

RTI_TASK_SUBMIT uses the ShellExecute function to launch a new Oinsight.exe to execute the task. Unlike OERUN, which similarly runs background tasks via the engine server, RTI_TASK_SUBMIT uses oinsight.exe to support tasks which require the presentation server, such as OIPI reports.

In immediate mode, the launched OInsight.exe will execute the requested task and terminate. In polling mode, the launched OInsight.exe will check to see if a “task manager” is currently running, and if it is not, it will remain running as the task manager, dispatching the requests to additional OInsight.exe instances. If a task manager is already running, the launched OInsight.exe will terminate, leaving the processing of the task to the already-running task manager.

See RTI_TASKMANAGER for configuration information.

RTI_TASK_SUBMIT can be called from any program, including other tasks or programs that are not in event context, such as INET and O4W routines. Launching OIPI reports and returning PDFS to web clients is a common use.

See Also

RTI_TASK_STATUSRTI_TASK_STARTUPRTI_TASK_SHUTDOWNRTI_TASKMANAGER

  • No labels

1 Comment

  1. Learned a few things that are not obvious to make this work properly:

    • The SYSTASKS system table (REVBOOT) needs to be defined in the local DBT. Since this table was introduced in newer versions of OpenInsight, it is likely that upgraded applications were never updated to include this table.
    • The CFG_AUTOEXEC record in the SYSENV table needs to be created. The default configuration is:
      <1> RTI_TASKMANAGER
      <2> {NumberQueues}
    • The docs above refer to a taskdetails argument, but the syntax omits this. The syntax is correct. taskdetails is a holdover and should be ignored.

    • The docs above state that the funcName argument can be a "function or subroutine". In OI 9.x, it actually needs to be a function or a VNAV error will result in RTI_TASKMANAGER. In OI 10 this is supposed to be fixed.
    • Behind the scenes, OpenInsight attempts to run the Declare_FCNS routine to create a DLL stub for the ShellExecute WinAPI. However, due to a missing row, this produces a Set_Status() error. This does not prevent RTI_TASK_SUBMIT from running, but it could cause problems for developer code that relies upon Get_Status() to verify that everything is in good shape. To avoid this issue, run the following from the System Monitor:

      RUN COPY_ROW 'SYSOBJ', '$WINAPI_SHELLEXECUTEEX', 'SYSOBJ', '$SHELLEXECUTEEX'