Skip to content

Latest commit

 

History

History
60 lines (48 loc) · 2.01 KB

custom-runtime-environments.mdx

File metadata and controls

60 lines (48 loc) · 2.01 KB

A runtime plugin is a function that can run process chain executables inside a certain runtime environment. See the runtime property of service metadata.

The plugin's function takes an executable to run and an output collector. The output collector is a simple interface, to which the executable's standard output should be forwarded. If required, the function can be a suspend function.

Use this plugin if you want to implement a special way to execute processing services. For example, you can implement a remote web service call, or you can use one of the existing runtimes and run a certain service in a special way (like in the example plugin below).

Type
runtime
Additional properties Type
supportedRuntime
(required)
string The name of the runtime this plugin provides. Use this value in your service metadata.
Function interface
suspend fun myRuntime(executable: model.processchain.Executable,
  outputCollector: helper.OutputCollector, vertx: io.vertx.core.Vertx)
Example descriptor (Source)
- name: ignoreError
  type: runtime
  scriptFile: conf/plugins/ignoreError.kt
  supportedRuntime: ignoreError
Example plugin script (Source)
import helper.OutputCollector
import helper.Shell.ExecutionException
import io.vertx.core.Vertx
import model.processchain.Executable
import runtime.OtherRuntime

fun ignoreError(executable: Executable, outputCollector: OutputCollector, vertx: Vertx) {
  try {
    OtherRuntime().execute(executable, outputCollector)
  } catch (e: ExecutionException) {
    if (e.exitCode != 1) {
      throw e
    }
  }
}