Event procedures or methods
- Last Updated: October 14, 2020
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
To handle the response from an asynchronous
request, you must define an event procedure or an event method. In this context, an
event procedure or an event
method is an internal procedure or method that executes in response to a
PROCEDURE-COMPLETE event. To define an event
procedure or method, you must:
- Specify the name of the event procedure or method using the
EVENT-HANDLERoption on theRUN...ASYNCHRONOUSstatement that executes the request. - Define an internal procedure or method with the same name as the
event procedure specified in the
RUN...ASYNCHRONOUSstatement.
Typical places where you might define the specified internal procedure or method include:
- The same procedure or method context as the
RUN...ASYNCHRONOUSstatement that specifies the event procedure or method. - An external procedure context that you specify using the
EVENT-HANDLERoption on theRUN...ASYNCHRONOUSstatement using its procedure handle. In this case, the external procedure context must be active in the client session before you execute theRUN...ASYNCHRONOUSstatement. - An external method context that you specify using the
EVENT-HANDLERoption on theRUN...ASYNCHRONOUSstatement using its object instance. In this case, the external object containing the external method context must be active in the client session before you execute theRUN...ASYNCHRONOUSstatement.Note: You can overload the callback method and the AVM will identify the most appropriate method to run by using the the signature of the method. The signature of the method is determined based on the output and input-output parameters passed to the procedure executed by the RUN statement.
You must define the specified internal
procedure or method with INPUT parameters that
correspond in type and order to the OUTPUT and INPUT-OUTPUT parameters that you specify on the RUN...ASYNCHRONOUS statement.
To receive results from the asynchronous request in an event procedure or method, you can access:
- The asynchronous request handle for the request using the
SELFsystem handle - The attributes and methods of the
ERROR-STATUSsystem handle to obtain error information from the request - Values passed as output parameters from the remote procedure to corresponding input parameters in the event procedure or method
- The
RETURN-VALUEfunction to get the return value from the request