ibek commented on code in PR #1515: URL: https://github.com/apache/camel-website/pull/1515#discussion_r2826570231
########## content/blog/2026/02/camel418-whatsnew/index.md: ########## @@ -0,0 +1,335 @@ +--- +title: "Apache Camel 4.18 What's New" +date: 2026-02-19 +draft: false +authors: [ davsclaus, oscerd ] +categories: [ "Releases" ] +preview: "Details of what we have done in the Camel 4.18 LTS release." +--- + +Apache Camel 4.18 LTS has just been [released](/blog/2026/02/RELEASE-4.18.0/). + +This release introduces a set of new features and noticeable improvements that we will cover in this blog post. + +## Camel Core + +Added the possibility to add `note`(s) to EIPs. This is intended for developer notes or other kind of notes, +that is convention to have at the source code. The note has no impaction on the running Camel. Another use case is +to build tutorials with half complete code, and have note(s) that describe what to do. + +## Camel Simple + +The simple language has been improved tremendously. + +### More Functions + +We have added 50 more functions to simple language so it now comes with a total of 114. + +There are now a lot more functions to work with the data such as String related functions, +and also math functions so you can sum totals, find the maximum or minimum value and more. + +For example, if you work with JSon data, then there is a new `safeQuote` function, +which will based on the data type quote the value if necessary. + +We also made it possible for Camel components and custom components to provide simple functions. +For example `camel-attachments` and `camel-base64` has a set of functions out of the box. + +#### Adding your own custom Functions + +You can now add custom functions that can be used as _first class_ functions in your simple expressions or predicates. + +We added a small example with a custom function [stock function](https://github.com/apache/camel-kamelets-examples/tree/main/jbang/simple-custom-function), +which returns a stock value which can be with Camels simple language with `${stock()}` as shown below: + +```yaml +- from: + uri: "timer:stock" + parameters: + period: 5000 + steps: + - log: | + + + Stock prices today + + ${stock()} + ${stock('AAPL')} + ${stock('IBM')} + + Have a nice day +``` + +### More Operators + +We also added 3 new operators. + +#### Elvis Operator + +The Elvis operator `?:` is used for returning the current value or a default value. +The following will return the username header unless its null or empty, which then the default value of Guest is returned. + +```java +simple("${header.username} ?: 'Guest'"); +``` + +#### Ternary Operator + +We have added the beloved `? :` ternary operator so you can do: + +```java +simple("${header.foo > 0 ? 'positive' : 'negative'}"); +``` + +#### Chain Operator + +The new `~>` chain operator is fantastic, when you have a new for calling functions from functions. +As this makes it much more readable and avoids cluttering when nesting functions inside functions. + +```java +simple("${substringAfter('Hello')} ~> ${trim()} ~> ${uppercase()}"); +``` + +The example above, will first substring the message body, then trim the result, and lastly then uppercase. + +### Init Blocks + +For users that use simple language for data mapping, or when having a larger simple expression, +then we have introduced init block. + +You can now in the top of your Simple expressions declare an initialization block that are used to define a set of local variables that are pre-computed, and can be used in the following Simple expression. This allows to reuse variables, and also avoid making the simple expression complicated when having inlined functions, and in general make the simple expression easier to maintain and understand. + +```text +$init{ + $greeting := ${upper('Hello $body}'} + $level := ${header.code > 999 ? 'Gold' : 'Silver'} +}init$ +{ + "message": "$greeting", + "status": "$level" +} +``` + +Here we have an init block which has 2 local variables assigned, that can then easily be reused in the simple +expression. + +You can also build local custom functions in the init block: + +```text +$init{ + $cleanUp ~:= ${trim()} ~> ${normalizeWhitespace()} ~> ${uppercase()} +}init$ +``` + +Notice how the function is defined using `~:=` which then allows the function to take in a parameter (message body by default). +You can then use that in the simple expression: + +```text +{ + "message": "$greeting ~> $cleanUp()", + "status": "$level" +} +``` + +### Better Documentation + +The simple documentation has been updated and all the functions and operators has been grouped +in different set of tables such as grouped by: numeric functions, string functions, list functions, date functions, etc. + +We also added some examples of many of the functions so you have a better understanding what each function can do. + +### Other Simple Improvements + +When using the simple language the returned result can now be trimmed via `trimResult: true`. +You can also pretty print the result (JSon or XML) via `pretty: true`. + +## Camel JBang + +Every command now has a generated documentation page on the website, that explains what the command do,\ +and every option supported. + +The `camel cmd send` command can now also send messages to a running infra service (via `--infra`), such as + +```shell +$ camel cmd send --body=hello --infra=nats +``` + +The `camel version list --fresh` will store the result to local disk, so when using `camel version list` then it includes +the latest information. + +Add new `validate` plugin that can be installed and then used for validating YAML DSL files without running Camel. +The validation is based on the YAML DSL schema specification. + +```shell +$ camel plugin add validate +$ camel validate yaml foo.camel.yaml +``` + +This functionality is also available as a Maven Plugin. + +```shell +$ mvn camel-yaml-dsl-validator:validate + +[INFO] --- camel-yaml-dsl-validator:4.18.0:validate (default-cli) @ camel-example-main-yaml --- +[INFO] Found [.../camel-examples/main-yaml/src/main/resources/routes/my-route.camel.yaml] YAML files ... +[INFO] Validating 1 YAML files ... +[WARNING] + +Validation error detected in 1 files + + File: my-route.camel.yaml + /0/route/from: property 'step' is not defined in the schema and the schema does not allow additional properties + /0/route/from: required property 'steps' not found +``` + +## Camel Kafka + +Configuring security with `camel-kafka` has been streamlined to be much easier and _similar_ for all kinds of Kafka security configurations. + +Previously, setting up authentication required manually constructing JAAS configuration strings, knowing the +correct login module class names, matching `securityProtocol` with `saslMechanism`, and handling special character +escaping in credentials. This complexity also led to 24 separate Kafka Kamelets in `camel-kamelets` to cover +different authentication combinations. + +A new `saslAuthType` option has been added that supports: `PLAIN`, `SCRAM_SHA_256`, `SCRAM_SHA_512`, `SSL`, +`OAUTH`, `AWS_MSK_IAM`, and `KERBEROS`. When set, the appropriate `securityProtocol`, `saslMechanism`, +and `saslJaasConfig` are automatically derived. + +For example, configuring SCRAM-SHA-512 authentication is now as simple as: + +```java +from("kafka:my-topic?brokers=localhost:9092&saslAuthType=SCRAM_SHA_512&saslUsername=user&saslPassword=pass") +``` + +Instead of the previous verbose approach: + +```java +from("kafka:my-topic?brokers=localhost:9092&securityProtocol=SASL_SSL&saslMechanism=SCRAM-SHA-512" + + "&saslJaasConfig=org.apache.kafka.common.security.scram.ScramLoginModule required username=\"user\" password=\"pass\";") +``` + +OAuth 2.0 authentication is also supported with dedicated options: `oauthClientId`, `oauthClientSecret`, +`oauthTokenEndpointUri`, and `oauthScope`. + +For programmatic use, a new `KafkaSecurityConfigurer` builder class provides a fluent API with +convenient factory methods such as `plain(username, password)`, `scramSha512(username, password)`, +`oauth(clientId, clientSecret, tokenEndpointUri)`, and more. + +The existing explicit configuration approach with `securityProtocol`, `saslMechanism`, and `saslJaasConfig` +continues to work as before -- the new simplified options are fully backward compatible. + +## Camel AI + +### Camel OpenAI + +TODO: Ivo Review Comment: Camel OpenAI adds new `embeddings` operation to generate vector embeddings from text for semantic search and RAG applications. Combining it with `camel-sql` and PostgreSQL + pgvector makes it a powerful setup which you have under control: ```yaml - route: from: uri: direct:index steps: - setVariable: name: text simple: "${body}" - to: uri: openai:embeddings parameters: embeddingModel: nomic-embed-text - setVariable: name: embedding simple: "${body.toString()}" - to: uri: sql:INSERT INTO documents (content, embedding) VALUES (:#text, :#embedding::vector) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
