Asynchronous Worker Applications

An asynchronous worker application is one that executes a method call that originates from another application running in the same node. The worker application must be defined in the schema in which the asynchronous method call is made. The information about the receiver, method name, and parameters is encapsulated in a JadeMethodContext instance.

The worker application must execute the asyncInitialize method on the Application class so that the internal structures required to process asynchronous method calls can be constructed and the application can be prepared to receive and process requests. This method is typically called from the initialize method for a worker application that processes asynchronous method calls.

The worker application can also execute the asyncFinalize method of the Application class to delete internal transient objects used in processing asynchronous method calls. The internal data structures are released after a worker terminates, even when this method is not called. This method is typically called from the finalize method for a worker application that processes asynchronous method calls.

The value of the applicationType property of the worker application can be ApplicationType_GUI or ApplicationType_Non_GUI. Requests are directed to a worker application by setting the workerAppName property of the JadeMethodContext instance to the name of the worker application. A number of copies of the worker application with the same name share a request queue and an asynchronous method call request is executed by the first worker application that becomes available.

The following examples show the coding of initialize and finalize methods for an asynchronous worker application.

awInitialize() updating;
begin
    app.asyncInitialize;
end;
awFinalize() updating;
begin
    app.asyncFinalize;
end;