Obtaining Results from an Asynchronous Method Call

The waitForMethods method on the Process class returns a JadeMethodContext instance for an asynchronous method call that has completed or timed out. This object provides methods to report on:

The following code fragment shows the result of an asynchronous method call being examined.

vars
    context: JadeMethodContext;
    cust: Customer;
    date: Date;
    completedContext: JadeMethodContext;
begin
    ...
    // Obtain context of last asynchronous call to complete
    completedContext := process.waitForMethods(context);
    // Check how things went and obtain the result
    if completedContext = null then
        write "All calls completed";
    elseif completedContext.getErrorNumber <> 0 then
        write "Error info: " & completedContext.getErrorText;
    elseif completedContext.isTimedOut then
        write "Call timed out";
    else
        write "Return value: " & completedContext.getReturnValue.String;
    endif;
    ...

You can use the getTimestamps method to return the information listed in the following table.

Parameter Description
invokeTS The timestamp value when the asynchronous method call was invoked using the JadeMethodContext instance
beginTS The timestamp value when the worker application began processing the asynchronous method call
finishTS The timestamp value when the worker application completed processing the asynchronous method call
harvestTS The timestamp when the receiver was returned by the waitForMethods method and reported as complete
qdepth The number of requests already queued when the asynchronous method call request was added to the queue

If the getTimestamps method is called: