Invoking a Method on a Saved Object

The jomInvokeMethod call, shown in the following example, is used to send the specified target method containing a variable list of parameters to the receiver, after switching to the specified target execution context.

int jomInvokeMethod(const DskHandle   *pHandle,
                    const DskObjectId *pTargetOid,
                    const DskObjectId *pParamTargetContext,
                    const DskObjectId *pTargetMethod,
                    DskParam          *pInParam,
                    DskParam          *pOutParam,
                    UInt32            lineNo)

After the method has finished, the execution context switches back to the current context. (This switch will typically be from the context of the package to the context of the user of the package he second optional parameter.) For more details about details about calling user methods from packages, see "Calling User Methods from Packages", in Chapter 8 of the JADE Developer’s Reference.

As the application context used by jomInvokeMethod is transient, it can switch to a context only within the same process. The mechanism is not designed to call a method running in another process in the node or in another node. In addition, as the context is transient, any connection between a context and a method to be invoked must be set up again if an application is stopped and then restarted.

If you want to save events to be called persistently so that methods would still be called if the application stops and restarts (for example, in a scheduler application), you would have to re-supply a context when the application restarts and events are loaded. The target method and object could be persistent but the context is not.

Although the callback mechanism is designed with packages in mind, you can also use it to allow a method to be invoked from within the same context.

The parameters for this call are described in the following subsections.