Developing an Executor

The Executor for a component is provided by composing a Java class to serve as a wrapper to your run-time functions. An object will be created from this class when this component is being told to execute, and specific functions will be invoked as defined below.

The main requirement that must be adhered to is that your Executor must ultimately implement an Isight-provided interface com.engineous.sdk.runtime.Component. However, the Isight SDK also provides an abstract class, com.engineous.sdk.runtime.AbstractComponent, that you can merely extend to allow you to implement only the methods you need.

In future releases, the Component interface will extend the SystemExtension interface, and it is suggested that all Component implementations extend the SystemExtension to prevent future incompatibilities. If a component class extends the AbstractComponent class, this step is already done by the abstract class and no component code changes are required.

The primary method that must be implemented is:

  • execute. Called to perform the execution functionality for the component. Uses (input) parameter value information from the context to set values in the application as necessary, makes any calls necessary to carry out whatever is defined as the execution for the component (possibly interacting with a back-end application), and sets output parameter values back in the Context.

The following methods are also available to implement (all are optional):

initialize
Called to initialize the Executor and to give a handle to the component type; might also start the application (for persistent applications).
destroy
Called to destroy the Executor; cleans up and shuts down application (for persistent applications). This method is called when the Runtime Gateway is exited (for local execution) or when the SIMULIA Execution Engine station is shut down (for distributed execution in the SIMULIA Execution Engine environment).
runtimeMessageReceived
Sends messages to the Executor to allow it to respond to various situations during the execution of the job.

The initialize and destroy methods are used primarily for persistent components. A persistent component is one that will not be started and stopped on every execution of the component but instead will be started once and reused for subsequent calls to execute the component, avoiding the overhead of a possibly long start up time and allowing the state of the application to be carried over from one execution to the next. A component is specified as persistent by setting a specific predefined property value (reusePolicy) when defining the component (see Reusable and Persistent Components for more details).

The runtimeMessageReceived method is useful for when your component needs to exit any executing code or external program immediately when a job is stopped/cancelled. It is also useful for persistent components to perform some cleanup logic after a job has ended (because destroy will not be called until the Gateway or station is exited as mentioned above).