This is an automated email from the ASF dual-hosted git repository. djencks pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 52074ab51d3f55c6e46a46114c196c6c7d315dca Author: David Jencks <[email protected]> AuthorDate: Mon Apr 27 20:40:16 2020 -0700 remove files moved to camel-k-runtime --- docs/modules/languages/nav-languages.adoc | 6 - docs/modules/languages/pages/groovy.adoc | 189 --------------------------- docs/modules/languages/pages/java.adoc | 25 ---- docs/modules/languages/pages/javascript.adoc | 35 ----- docs/modules/languages/pages/kotlin.adoc | 105 --------------- docs/modules/languages/pages/languages.adoc | 21 --- docs/modules/languages/pages/xml.adoc | 23 ---- 7 files changed, 404 deletions(-) diff --git a/docs/modules/languages/nav-languages.adoc b/docs/modules/languages/nav-languages.adoc deleted file mode 100644 index 377ca33..0000000 --- a/docs/modules/languages/nav-languages.adoc +++ /dev/null @@ -1,6 +0,0 @@ -* xref:languages:languages.adoc[Languages] -** xref:languages:groovy.adoc[Groovy] -** xref:languages:kotlin.adoc[Kotlin] -** xref:languages:javascript.adoc[JavaScript] -** xref:languages:java.adoc[Java] -** xref:languages:xml.adoc[XML] diff --git a/docs/modules/languages/pages/groovy.adoc b/docs/modules/languages/pages/groovy.adoc deleted file mode 100644 index 5232b6b..0000000 --- a/docs/modules/languages/pages/groovy.adoc +++ /dev/null @@ -1,189 +0,0 @@ -= Writing Integrations in Groovy - -An integration written in Groovy looks very similar to a Java one except it can leverages Groovy's language enhancements over Java such as closures: - -[source,groovy] ----- -from('timer:tick') - .process { it.in.body = 'Hello Camel K!' } - .to('log:info') ----- - -You can run it with the standard command: - -``` -kamel run example.groovy -``` - -== Configuring the Application - -Camel K extends the Camel Java DSL making it easier to configure Camel's behavior using the top level _camel_ block - -[source,groovy] ----- -camel { - // configure camel here -} ----- - -The _camel_ block allows to configure the following Camel features: - -- **Components** -+ -[source,groovy] ----- -camel { - components { - seda { // <1> - queueSize = 1234 - concurrentConsumers = 12 - } - - log { // <2> - exchangeFormatter = { - 'body ==> ' + it.in.body - } as org.apache.camel.spi.ExchangeFormatter - } - - mySeda(SedaComponent) { // <3> - queueSize = 4321 - concurrentConsumers = 21 - } - } -} ----- -<1> configure the properties of the component whit name _seda_ -<2> configure the properties of the component whit name _log_ -<3> creates and configure a component of type `SedaComponent` whose name is _mySeda_ -+ -Setting the property _exchangeFormatter_ looks a little ugly as you have to declare the type of your closure. For demonstration purpose we have created a Groovy extension module that simplify configuring the _exchangeFormatter_ so you can rewrite your DSL as -+ -[source,groovy] ----- -camel { - components { - log { - formatter { - 'body ==> ' + it.in.body - } - } - } -} ----- -+ -which is much better. -+ -[TIP] -==== -You can provide your custom extensions by packaging them in a dependency you declare for your integration. -==== - -- **Languages ** -+ -[source,groovy] ----- -camel { - languages { - language("bean") { // <1> - beanType = String.class - method = "toUpperCase" - } - myBean(BeanLanguage) { // <2> - beanType = String.class - method = "toLowerCase" - } - simple { // <3> - } - } -} ----- -<1> configure the properties of the language whit name _bean_ -<2> creates and configure a language of type `BeanLanguage` whose name is _myBean_ -<3> configure the properties of the language whit name _simple_ - -- **DataFormats** -+ -[source,groovy] ----- -camel { - dataFormats { - dataFormat("json-jackson") { // <1> - unmarshalType = Map.class - prettyPrint = true - } - myJackson(JacksonDataFormat) { // <2> - unmarshalType = String.class - prettyPrint = false - } - csv { // <3> - } - } -} ----- -<1> configure the properties of the data format whit name _json-jackson_ -<2> creates and configure a data format of type `JacksonDataFormat` whose name is _myJackson_ -<3> configure the properties of the data format whit name _csv_ - - -== Beans - -Beans can be bound to the _registry_ using a dedicated _bean DSL_ : - -[source,groovy] ----- -beans { - myCache = Caffeine.newBuilder().build() // <1> - - myProcessor = processor { // <2> - it.in.body = 'Hello Camel K!' - } - - myPredicate = predicate { // <3> - it.in.body != null - } - - dataSource(org.apache.commons.dbcp2.BasicDataSource) { //<4> - driverClassName = "org.h2.Driver" - url = "jdbc:h2:mem:camel" - username = "sa" - password = "" - } -} ----- -<1> define a bean -<2> define a custom processor -<3> define a custom predicate -<4> define a custom bean with name `dataSource` and type `org.apache.commons.dbcp2.BasicDataSource` - - -== Rest Support - -Integrations's REST endpoints can be configured using the top level _rest_ block: - -[source,groovy] ----- -rest { - configuration { // <1> - host = 'my-host' - port '9192' - } - - path('/my/path') { - get('/get') { // <2> - consumes 'application/json' - produces 'application/json' - to 'direct:get' - } - } - - post { // <3> - path '/post' - consumes 'application/json' - produces 'application/json' - to 'direct:post' - } -} ----- -<1> Configure the rest engine -<2> Configure the behavior of the method GET for the path '/my/path/get' and invoke the endpoint 'direct:get' -<3> Configure the behavior of the method POST for the path '/post' and invoke the endpoint 'direct:post' diff --git a/docs/modules/languages/pages/java.adoc b/docs/modules/languages/pages/java.adoc deleted file mode 100644 index 127a7d9..0000000 --- a/docs/modules/languages/pages/java.adoc +++ /dev/null @@ -1,25 +0,0 @@ -= Writing Integrations in Java - -Using Java to write an integration to be deployed using Camel K is no different from defining your routing rules in Camel with the only difference that you do not need to build and package it as a jar. - -[source,java] -.Example.java ----- -import org.apache.camel.builder.RouteBuilder; - -public class Sample extends RouteBuilder { - @Override - public void configure() throws Exception { - from("timer:tick") - .setBody() - .constant("Hello Camel K!") - .to("log:info"); - } -} ----- - -You can run it with the standard command: - -``` -kamel run Example.java -``` diff --git a/docs/modules/languages/pages/javascript.adoc b/docs/modules/languages/pages/javascript.adoc deleted file mode 100644 index 3ffc8d0..0000000 --- a/docs/modules/languages/pages/javascript.adoc +++ /dev/null @@ -1,35 +0,0 @@ -= Writing Integrations in Javascript - -An integration written in JavaScript looks very similar to a Java one: - -[source,js] -.hello.js ----- -const Processor = Java.extend(Java.type("org.apache.camel.Processor")); - -function proc(e) { - e.getIn().setBody('Hello Camel K!') -} - -from('timer:tick') - .process(new Processor(proc)) - .to('log:info') ----- - -To run it, you need just to execute: - -``` -kamel run hello.js -``` - -For JavaScript integrations, Camel K does not yet provide an enhanced DSL but you can access to some global bounded objects such as a writable registry and the camel context so to set the property _exchangeFormatter_ of the _LogComponent_ as done in previous example, you can do something like: - -[source,js] ----- - -l = context.getComponent('log', true, false) -l.exchangeFormatter = function(e) { - return "log - body=" + e.in.body + ", headers=" + e.in.headers -} ----- - diff --git a/docs/modules/languages/pages/kotlin.adoc b/docs/modules/languages/pages/kotlin.adoc deleted file mode 100644 index 1696205..0000000 --- a/docs/modules/languages/pages/kotlin.adoc +++ /dev/null @@ -1,105 +0,0 @@ -= Writing Integrations in Kotlin - -An integration written in Kotlin looks very similar to a Java one except it can leverages Kotlin's language enhancements over Java: - -[source,kotlin] ----- -from("timer:tick") - .process { e -> e.getIn().body = "Hello Camel K!" } - .to("log:info") ----- - -You can run it with the standard command: - -``` -kamel run example.kts -``` - -Camel K extends the Camel Java DSL making it easier to configure the context in which the integration runs using the top level _context_ block - -[source,kotlin] ----- -context { - // configure the context here -} ----- - -At the moment the enhanced DSL provides a way to bind items to the registry, to configure the components the context creates and some improvements over the REST DSL. - -== Registry Configuration - -The registry is accessible using the _registry_ block inside the _context_ one: - -[source,kotlin] ----- -context { - registry { - bind("my-cache", Caffeine.newBuilder().build()) // <1> - bind("my-processor", processor { // <2> - e -> e.getIn().body = "Hello" - }) - bind("my-predicate", predicate { // <3> - e -> e.getIn().body != null - }) - } -} ----- -<1> bind a simple bean to the context -<2> define a custom processor to be used later in the routes by ref -<3> define a custom predicate to be used later in the routes by ref - - -== Components Configuration - -Components can be configured within the _components_ block inside the _context_ one: - -[source,kotlin] ----- -context { - components { - component<SedaComponent>("seda") { //<1> - queueSize = 1234 - concurrentConsumers = 12 - } - - component<SedaComponent>("mySeda") { // <2> - queueSize = 4321 - concurrentConsumers = 21 - } - - component<LogComponent>("log") { // <3> - setExchangeFormatter { - e: Exchange -> "" + e.getIn().body - } - } - } -} ----- -<1> configure the properties of a component whit type _SedaComponent_ and name _seda_ -<2> configure the properties of a component with type SedaComponent and name _mySeda_, note that as _mySeda_ does not represent a valid component scheme, a new component of the required type will be instantiated. -<3> configure the properties of the component whit name _log_ - -[NOTE] -==== -As for Groovy, you can provide your custom extension to the DSL -==== - -== Rest Endpoints - -Integrations's REST endpoints can be configured using the top level _rest_ block: - -[source,kotlin] ----- -rest { - configuration { // <1> - host = "my-host" - port = "9192" - } - - path("/my/path") { // <2> - // standard Rest DSL - } -} ----- -<1> Configure the rest engine -<2> Configure the rest endpoint for the base path '/my/path' diff --git a/docs/modules/languages/pages/languages.adoc b/docs/modules/languages/pages/languages.adoc deleted file mode 100644 index d1f2af6..0000000 --- a/docs/modules/languages/pages/languages.adoc +++ /dev/null @@ -1,21 +0,0 @@ -[[languages]] -= Languages - -Camel K supports multiple languages for writing integrations: - -.Supported Languages -[options="header"] -[cols="30%,70%"] -|======================= -| Language | Description -| xref:groovy.adoc[Groovy] | Groovy `.groovy` files are supported. -| xref:kotlin.adoc[Kotlin] | Kotlin Script `.kts` files are supported. -| xref:javascript.adoc[JavaScript] | JavaScript `.js` files are supported. -| xref:java.adoc[Java] | Integrations written in plain Java DSL are supported. -| xref:xml.adoc[XML] | Integrations written in plain XML DSL are supported (Spring XML or Blueprint not supported). -|======================= - -More information about supported languages is provided in the language specific section. - -Integrations written in different languages are provided in the examples pack that is downloadable from the https://github.com/apache/camel-k/releases[release page]. - diff --git a/docs/modules/languages/pages/xml.adoc b/docs/modules/languages/pages/xml.adoc deleted file mode 100644 index c03876c..0000000 --- a/docs/modules/languages/pages/xml.adoc +++ /dev/null @@ -1,23 +0,0 @@ -= Writing Integrations in XML - -Camel K support the classic XML DSL available in Camel: - -[source,xml] -.example.xml ----- -<routes xmlns="http://camel.apache.org/schema/spring"> - <route> - <from uri="timer:tick"/> - <setBody> - <constant>Hello Camel K!</constant> - </setBody> - <to uri="log:info"/> - </route> -</routes> ----- - -You can run it by executing: - -``` -kamel run example.xml -```
