Extending Steep through plugins

Process chain adapters

A process chain adapter plugin is a function that can manipulate generated process chains before they are executed.

It takes a list of generated process chains and a reference to the workflow from which the process chains have been generated. It returns a new list of process chains to execute or the given list if no modification was made. If required, the function can be a suspend function.

Type
processChainAdapter
Additional propertiesType
dependsOn
(optional)
arrayAn optional list of names of other process chain adapter plugins that need to be executed before this plugin. If this property is not given, the order in which process chain adapter plugins are applied to process chains is undefined.
Function interface
suspend fun myProcessChainAdapter(processChains: List<model.processchain.ProcessChain>,
  workflow: model.workflow.Workflow, vertx: io.vertx.core.Vertx): List<model.processchain.ProcessChain>
Example descriptor
- name: myProcessChainAdapter
  type: processChainAdapter
  scriptFile: conf/plugins/myProcessChainAdapter.kt
Example plugin script
import model.processchain.ProcessChain
import model.workflow.Workflow
import io.vertx.core.Vertx
 
suspend fun myProcessChainAdapter(processChains: List<ProcessChain>,
    workflow: Workflow, vertx: Vertx): List<ProcessChain> {
  val result = mutableListOf<ProcessChain>()
 
  for (pc in processChains) {
    // never execute the 'sleep' service
    val executables = pc.executables.filter { e -> e.id != "sleep" }
    result.add(pc.copy(executables = executables))
  }
 
  return result
}