Running Operon from Apache Camel

To use Operon with Java, the Java version 11 or later is required. If you are using maven, please add the repository to your project's pom.xml.

  <repositories>
      <!-- For operon-runner -->
      <repository>
          <id>operon-site</id>
          <url>https://operon.io/maven-repository</url>
      </repository>
  </repositories>

To use Operon with Camel requires the camel-operon -component to be installed first. The camel-operon -dependency is as follows (requires the operon-site -repository):

  <dependency>
    <groupId>io.operon</groupId>
    <artifactId>camel-operon</artifactId>
    <version>1.0-SNAPSHOT</version>
  </dependency>

Examples

from("timer://foo")
	.setBody(constant("Select: 123"))
	.to("operon://foo")
	.log("Result :: " + simple("${body}"));
from("timer://foo")
	.setHeader("initialValue", constant("{\"foo\": \"bar\"}"))
	.setBody(constant("Select: $.foo"))
	.to("operon://foo");

Options

  • queryFile : java.lang.String. When starts with "file://" then tries to load the query from the file-system, otherwise from the classpath.
  • outputResult : boolean (default false). When set, the Operon will output result to System.out
  • prettyPrint : boolean (default false). When set, the result will be formatted.
  • printDuration : boolean (default false). When set, the query execution time will be print to System.out
  • debug : boolean (default false). When set, some debug-information is printed during the component execution.
  • timezone : java.lang.String. When set, the default-timezone will be overridden for date-functions.

Operon with Camel YAML DSL

#
# (C) 2021 operon.io, MIT-license
#
- from:
    uri: "timer://foo"
    steps:
      - set-body:
          constant: >
            Select:
                -> http:{"url": "https://api.coindesk.com/v1/bpi/currentprice.json"}
                .body
                ..EUR
                [1]
                .rate_float

      - to:
          uri: "operon://foo"

      - log:
          message: "Operon result: ${body}"