Qorus Integration Engine® Enterprise Edition 6.0.19_prod
Loading...
Searching...
No Matches
Implementing Qorus Objects Using YAML format

Back to the Developer's Guide Table of Contents

YAML Definition Files of Qorus Objects

All Qorus integration objects are described by YAML metadata produced by our IDE, which is available as a free (as in free of charge and also open source) extension to Microsoft Visual Studio Code, a multi-platform editor from Microsoft. The Qorus extension is called Qorus Developer Tools and can be installed directly from Visual Studio Code.

The IDE generates YAML files for Qorus objects.

Qorus YAML definition files should have the extension *.yaml to identify the file's contents properly to the schema loader.

YAML definition files are used to create Qorus object definitions in the Qorus schema.

YAML schemas for Qorus object definition files:

Object YAML Schema Example
Qorus classes class_schema.yaml class.yaml
Qorus services service_schema.yaml service.yaml
Qorus steps step_schema.yaml step.yaml
Qorus jobs job_schema.yaml job.yaml
Qorus workflows workflow_schema.yaml workflow.yaml
Qorus workflow errors errors_schema.yaml errors.yaml
Qorus functions function_schema.yaml function.yaml
Qorus mappers mapper_schema.yaml mapper.yaml
Qorus value maps value-map_schema.yaml value-map.yaml
Qorus constants constant_schema.yaml constant.yaml
Qorus workflow events event_schema.yaml event.yaml
Qorus queues queue_schema.yaml queue.yaml
Qorus groups group_schema.yaml group.yaml
Qorus connections connection_schema.yaml connection.yaml
Qorus config item values config-item-values_schema.yaml config-item-values.yaml
Qorus types type_schema.yaml type.yaml
Qorus pipelines pipeline_schema.yaml pipeline.yaml
Qorus finite state machines fsm_schema.yaml fsm.yaml

YAML type definitions:

Object YAML type definition
Qorus config item config-item_definition.yaml
Qorus service method service-method_definition.yaml
Qorus cron cron_definition.yaml
Qorus workflow error error_definition.yaml
Qorus class connectors class-connector_definition.yaml
Qorus class processor processor_definition.yaml

For Qorus objects that support user code there is a code tag that tells oload: Data Loading Tool and Schema Manager where the source code is located.

Note
  • It is recommended to have YAML definition files in the same directory with the user code
  • YAML definition files support only class-based user code for services, jobs, and workflows

YAML Formatted Data

The IDE allows for complex data structures to be written in YAML; this allows lists, hashes, and nested data types to be defined consistently in the IDE. Any valid YAML encoding syntax up to and including YAML 1.1 is supported in YAML data in the IDE (and in Qorus where YAML is parsed), including block style and YAML comments.

YAML was chosen as it is extensible, very expressive, concise, and also human-readable.

See the following table for supported data types and YAML encoded string examples.

Qore YAML Data Types With Examples

Qore Data Type Example Notes
int 100 Lossless bidirectional conversion
float 1.01
@nan @
@inf </td>
Lossless bidirectional conversion
number 2.5n
10n{256}
!number "@inf@n"
!number "@nan@n"
Lossless bidirectional conversion (full number with precision is serialized in the YAML string)
string an implicit string
"quoted string"
Lossless bidirectional conversion only with UTF-8-encoded strings; non-UTF-8 encoding information is lost, YAML strings are always encoded in UTF-8 encoding
bool true
false
Lossless bidirectional conversion
date (relative / duration) P2M3DT10H14u Lossless bidirectional conversion
date (absolute) 2010-05-05T15:35:02.100 Lossless bidirectional conversion for YAML timestamp values up to microsecond resolution; fractional microsecond information is lost
binary !!binary "q80=" Lossless bidirectional conversion; must use canonical YAML encoding using base64-encoded data for binary values
nothing null Lossless bidirectional conversion; note that Qore's SQL NULL value is serialized to YAML null and therefore is a lossy conversion
list [1, two, 3.0]
- 1
- two
- 3.0
Lossless bidirectional conversion
hash {a: 1, b: two}
a: 1 \nb: two
Lossless bidirectional conversion
Example
Given the following YAML document:
doe: "a deer, a female deer"
ray: "a drop of golden sun"
pi: 3.14159
xmas: true
french-hens: 3
calling-birds:
  - huey
  - dewey
  - louie
  - fred
xmas-fifth-day:
  calling-birds: four
  french-hens: 3
  golden-rings: 5
  partridges:
    count: 1
    location: "a pear tree"
  turtle-doves: two

Deserialized as Qore data and logged with N, the result is:
hash: (7 members)
  doe : "a deer, a female deer"
  ray : "a drop of golden sun"
  pi : 3.14159
  xmas : True
  french-hens : 3
  calling-birds : list: (4 elements)
    [0]="huey"
    [1]="dewey"
    [2]="louie"
    [3]="fred"
  xmas-fifth-day : hash: (5 members)
    calling-birds : "four"
    french-hens : 3
    golden-rings : 5
    partridges : hash: (2 members)
      count : 1
      location : "a pear tree"
    turtle-doves : "two"

YAML References