Hi

After the 3.11 release, then I have worked a little bit on adding some
more power to Kamelets.
https://issues.apache.org/jira/browse/CAMEL-16630


This time it's to allow you to write a bit of inlined code (groovy,
java via joor, javascript, or kotlin). Though it was mainly groovy and
joor that I have been focused on (for now).

The coding/scripting is especially needed with EIPs that uses
AggregationStrategy where you need to write some code how 2 messages
should be merged together.

The first commits has been pushed and there are some unit tests that
demonstrate this in the YAML DSL where we have a set of unit tests
(groovy based).

So here is Java code via jOOR:

https://github.com/apache/camel/blob/main/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/RouteTemplateTest.groovy#L333


And here is groovy:
https://github.com/apache/camel/blob/main/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/RouteTemplateTest.groovy#L378


The code logic is basic but that is not the case here as you can write
almost any kind of java or groovy code here (but keep it limited). Its
a script so intended as a single method. However in the groovy example
we create a class with a single method that has the method singatures
we want for the aggregator. But with java jOOR we use a lambda
expression (e1, e2) with the exchanges as parameters.

It may take a while to understand and grook. But it brings new powers
to the table for kamelet developers where you can now inlined the code
directly in the yaml file so the kamelet is self contained.






-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to