Components are the building blocks of process modules. Components define the processes and status rules that run in the process client plus the services that can be called from the process client.
Components are grouped together into group profiles, which describe the functionality of different types of group (folder) in the process client. Component can be included in worker templates as a source of worker process definitions and status rules. The overall process module definition is then created from a list of group profiles.
Component methods
A process module component is a very loose concept. In its simplest form, a component is a node that when included using application.require() returns an object with some standard methods.
|
getContext()
|
Return the process component node.
|
|
getName()
|
Return the name of the process component.
|
|
getReference()
|
Return a reference for the process component. References are unique within a process module.
|
|
getProcessRoles()
|
Return a list of roles supported by this component.
|
|
getProcessDefinition(role)
|
Return the process definition for the role. Role of 'group' and 'control' are used for group-level and control processes.
|
|
getStatusRules(role)
|
Return the status rules for the role. Role of 'group' used for group-level status rules.
|
|
getProcessOptions()
|
Return options for this component that should be used by component that include it. Defaults to the component options, but may be overridden. |
|
getProcessBindings()
|
Return an object that holds the bindings. Dot-delimited binding references are converted to nested objects. Defaults to the components bindings, but may be overridden.
|
|
getWorkerProcessDefinition()
|
Return worker process definition.
|
|
getWorkerStatusRules()
|
Return worker status rules.
|
|
getGroupProcessDefinition()
|
Return group process definition.
|
|
getGroupStatusRules()
|
Return group status rules.
|
|
getControlProcessDefinition()
|
Return the control process definition supported by this module.
|
|
runRequest()
|
Optional method, required if the component is to be called as a service. Respond to an incoming request encoded as data in the "requestData" attribute. Return a response as an object (not a JSON string), or set the application error. Calls to the control process' "service" action are forwarded to the runRequest() method. See Process module service for details of this call.
|
Components can have other methods called from the above methods, particularly to implement the runRequest() method.
The getProcessDefinition() and getStatusRules() require some explanation. The original version had specific methods for worker, group and control. This has been superceded by more general method, to allow for multiple worker roles. The role-specific methods are retained for backward compatibility. Classes that extend Component Script should implement either the general methods or the role-specific methods.
Script component
The Script Component type can be used to create a component using a script. The Component Script can be used as the base for the script.
Process specification
The Process Specification type can be used to create a component for multiple roles, including one or more worker roles, group role and control role.
Process component
The Process Component type can be used to create a component from one or more of the following:
- Process definitions for the control process
- Process definitions for workers
- Status rules for workers
- Process definitions for groups
- Status rules for groups
It supports placeholder replacement, allowing the process definitions and status rules to be parametised as required.
The Process Specification should be used in preference for new solutions, as it is more flexible and copes with edge cases more elegantly.
Process model component
A Process model can be converted into a component to be included into other components or group profiles, using the Process Model Component type.
The granularity of components is different from that of process models, and the process model component must specify which parts of the process model to include in the component. This involves mapping a role to each of the component process types (worker, process and control).
The component can also provide options which override the process-level properties of the process model, and bindings which apply to the process model.