You can redefine two methods of the DXACTBAS1 ancestor class to perform one-off tasks when your Activity Processor is loaded and unloaded by the Processing Sequence controller. These methods are:
- ActivityLoad
- ActivityUnload
These methods may become particularly significant when your Activity is defined with the Keep Active attribute. In this case, for a Processing Sequence that executes the activity more than once, the sequence of method calls in the Activity Processor is like this:
- ActivityLoad (the first time the Activity is executed)
- ActivityInit … ActivityRun … ActivityTerm (for each time the Activity is executed)
- ActivityInit … ActivityRun … ActivityTerm (for each time the Activity is executed)
- Etc …
- ActivityUnload (when the Processing Sequence ends)
Defining your Activity with the Keep Active attribute (and implementing your Activity Processor to support it) can offer the potential of significant performance benefits for Activities:
- That are likely to be used more than once in a Processing Sequence run.
- That have a significant load and/or unload cost (in performance terms) that need not be repeated for every execution of the Activity.
For example, an Activity that exclusively uses a single LANSA Integrator (JSM) service could be written to load and initialize the service and then use the same connection handle for all subsequent executions in the same Processing Sequence. In this event, it might redefine the ActivityUnload method to unload the JSM service and close the JSM connection.