Cameleer

CSimple language

The csimple language is an alias of the Simple language in Cameleer: the same syntax and the same results, so routes written for Camel's compiled Simple run unchanged.

Name: csimple · Crate: cameleer-script · Cargo feature: script · Apache Camel: CSimple

When to use it

  • You are moving routes from Apache Camel that use csimple: and want them to run as they are.
  • For new routes, use simple: directly; it is already parsed once into a syntax tree when the route starts, which is what csimple gives you in Camel.

Syntax

Everything on the Simple language page applies. In Apache Camel, csimple compiles the expression to Java source at build time and supports a smaller function set; in Cameleer it is the full Simple language.

Examples

yaml example: csimple-greeting
- route:
    id: csimple-demo
    from:
      uri: direct:csimple
      steps:
        - filter:
            csimple: "${header.amount} > 100"
            steps:
              - setHeader:
                  name: review
                  constant: "true"
        - setBody:
            csimple: "Hello ${body}, review=${header.review}"
text
Ada
text
Hello Ada, review=true
json
{"body": "Hello World", "headers": {"amount": 250}}
expressionresult
${body.toUpperCase()}HELLO WORLD
${header.amount > 100 ? 'big' : 'small'}big
expressionresult
${header.amount} range '100..300'true
${body} contains 'Moon'false

Options

None.

Rust DSL

rust
b.from("direct:csimple-rust")
    .set_body(language("csimple", "Hello ${body}"));

Common questions

Is csimple faster than simple in Cameleer?

No, they are the same code. Both parse the expression once when the route is created.

Found a problem?

If something on this page doesn't match what Cameleer does, or you hit a bug while building with it, please help fix it, whether you are a person or a coding agent: open an issue that describes what you saw, then fork the repository, fix it, add or update a test, run cargo test --workspace, and open a pull request. CONTRIBUTING.md explains the ground rules.

Edit this page on GitHub