diff --git a/examples/RestWithRestlet.java b/examples/RestWithUndertow.java similarity index 84% rename from examples/RestWithRestlet.java rename to examples/RestWithUndertow.java index 188d8adf14..63090a624e 100644 --- a/examples/RestWithRestlet.java +++ b/examples/RestWithUndertow.java @@ -18,15 +18,15 @@ // // To run this integrations use: // -// kamel run --name=rest-with-restlet --dependency=camel-rest --dependency=camel-restlet examples/RestWithRestlet.java +// kamel run --name=rest-with-undertow --dependency=camel-rest --dependency=camel-undertow examples/RestWithUndertow.java // import org.apache.camel.Exchange; -public class RestWithRestlet extends org.apache.camel.builder.RouteBuilder { +public class RestWithUndertow extends org.apache.camel.builder.RouteBuilder { @Override public void configure() throws Exception { restConfiguration() - .component("restlet") + .component("undertow") .host("0.0.0.0") .port("8080"); diff --git a/examples/polyglot/JavaRoute.java b/examples/polyglot/JavaRoute.java new file mode 100644 index 0000000000..2522b34995 --- /dev/null +++ b/examples/polyglot/JavaRoute.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.BindToRegistry; +import org.apache.camel.Processor; + +public class JavaRoute extends RouteBuilder { + @Override + public void configure() throws Exception { + } + + @BindToRegistry + public static Processor javaProcessor() { + return e -> e.getMessage().setHeader("MyHeader", "HelloFromJava"); + } +} \ No newline at end of file diff --git a/examples/polyglot/README.adoc b/examples/polyglot/README.adoc new file mode 100644 index 0000000000..76f29bc92a --- /dev/null +++ b/examples/polyglot/README.adoc @@ -0,0 +1,8 @@ += Example of route built using multiple DSl + +To run it: + +[source,shell] +---- +$ kamel run --name polyglot routes.xml beans.groovy JavaRoute.java +---- \ No newline at end of file diff --git a/examples/polyglot/beans.groovy b/examples/polyglot/beans.groovy new file mode 100644 index 0000000000..cdfaf012b1 --- /dev/null +++ b/examples/polyglot/beans.groovy @@ -0,0 +1,23 @@ +// camel-k: language=groovy +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +beans { + groovyProcessor = { + it.in.body = 'Hello from Groovy' + } as org.apache.camel.Processor +} \ No newline at end of file diff --git a/examples/polyglot/routes.xml b/examples/polyglot/routes.xml new file mode 100644 index 0000000000..e7d2bc79e5 --- /dev/null +++ b/examples/polyglot/routes.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + +