This is an automated email from the ASF dual-hosted git repository. oalsafi pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new c3c4f91 Re-initiate examples generation in gulp.js and remove links to camel-examples new 3a6b1f5 Merge pull request #3568 from omarsmak/fix-examples-gulp c3c4f91 is described below commit c3c4f91899948841089560fcf6b98bd296ec29e0 Author: Omar Al-Safi <omars...@gmail.com> AuthorDate: Tue Feb 11 15:34:59 2020 +0100 Re-initiate examples generation in gulp.js and remove links to camel-examples --- docs/gulpfile.js | 10 +-- .../resources/META-INF/spring/camel-context.xml | 43 ------------ .../example/jmstofile/CamelJmsToFileExample.java | 81 ---------------------- .../modules/ROOT/pages/console-example.adoc | 18 ++++- .../ROOT/pages/walk-through-an-example.adoc | 18 +++-- 5 files changed, 31 insertions(+), 139 deletions(-) diff --git a/docs/gulpfile.js b/docs/gulpfile.js index b5eb64f..6380dd9 100644 --- a/docs/gulpfile.js +++ b/docs/gulpfile.js @@ -204,11 +204,5 @@ const examples = series(deleteExamples, createUserManualExamples, createComponen exports.symlinks = symlinks; exports.nav = nav; -// We moved the examples to the `camel-examples` repository, -// this made sure that the examples were copied to the -// correct place for the documentation, according to the -// Antora directory structure. For now the examples are -// copied over from `camel-examples` manually. -//exports.examples = examples; -//exports.default = series(symlinks, nav, examples); -exports.default = series(symlinks, nav); +exports.examples = examples; +exports.default = series(symlinks, nav, examples); diff --git a/docs/user-manual/modules/ROOT/examples/examples/camel-example-console/src/main/resources/META-INF/spring/camel-context.xml b/docs/user-manual/modules/ROOT/examples/examples/camel-example-console/src/main/resources/META-INF/spring/camel-context.xml deleted file mode 100644 index 5cfd369..0000000 --- a/docs/user-manual/modules/ROOT/examples/examples/camel-example-console/src/main/resources/META-INF/spring/camel-context.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - - 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 xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd - http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> - - <!-- tag::e1[] --> - <!-- camelContext is the Camel runtime, where we can host Camel routes --> - <camelContext xmlns="http://camel.apache.org/schema/spring"> - <route> - <!-- read input from the console using the stream component --> - <from uri="stream:in?promptMessage=Enter something: "/> - <!-- transform the input to upper case using the simple language --> - <!-- you can also use other languages such as groovy, ognl, mvel, javascript etc. --> - <transform> - <simple>${body.toUpperCase()}</simple> - </transform> - <!-- and then print to the console --> - <to uri="stream:out"/> - </route> - </camelContext> - <!-- end::e1[] --> - -</beans> diff --git a/docs/user-manual/modules/ROOT/examples/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java b/docs/user-manual/modules/ROOT/examples/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java deleted file mode 100644 index 4d949ff..0000000 --- a/docs/user-manual/modules/ROOT/examples/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ -package org.apache.camel.example.jmstofile; - -import javax.jms.ConnectionFactory; - -import org.apache.activemq.ActiveMQConnectionFactory; -import org.apache.camel.CamelContext; -import org.apache.camel.ProducerTemplate; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.jms.JmsComponent; -import org.apache.camel.impl.DefaultCamelContext; - -/** - * An example class for demonstrating some of the basics behind Camel. This - * example sends some text messages on to a JMS Queue, consumes them and - * persists them to disk - */ -public final class CamelJmsToFileExample { - - private CamelJmsToFileExample() { - } - - public static void main(String args[]) throws Exception { - // tag::e1[] - CamelContext context = new DefaultCamelContext(); - // end::e1[] - // Set up the ActiveMQ JMS Components - // tag::e2[] - ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false"); - // Note we can explicit name the component - context.addComponent("test-jms", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory)); - // end::e2[] - // Add some configuration by hand ... - // tag::e3[] - context.addRoutes(new RouteBuilder() { - public void configure() { - from("test-jms:queue:test.queue").to("file://test"); - } - }); - // end::e3[] - // Camel template - a handy class for kicking off exchanges - // tag::e4[] - ProducerTemplate template = context.createProducerTemplate(); - // end::e4[] - // Now everything is set up - lets start the context - context.start(); - // Now send some test text to a component - for this case a JMS Queue - // The text get converted to JMS messages - and sent to the Queue - // test.queue - // The file component is listening for messages from the Queue - // test.queue, consumes - // them and stores them to disk. The content of each file will be the - // test we sent here. - // The listener on the file component gets notified when new files are - // found ... that's it! - // tag::e5[] - for (int i = 0; i < 10; i++) { - template.sendBody("test-jms:queue:test.queue", "Test Message: " + i); - } - // end::e5[] - - // wait a bit and then stop - Thread.sleep(1000); - context.stop(); - } -} diff --git a/docs/user-manual/modules/ROOT/pages/console-example.adoc b/docs/user-manual/modules/ROOT/pages/console-example.adoc index e820b1f..235efd4 100644 --- a/docs/user-manual/modules/ROOT/pages/console-example.adoc +++ b/docs/user-manual/modules/ROOT/pages/console-example.adoc @@ -11,9 +11,23 @@ case and prints it back to the console. This is implemented with a Camel route defined in the Spring XML markup shown below: -[source,java] +[source,xml] ---- -include::{examplesdir}/examples/camel-example-console/src/main/resources/META-INF/spring/camel-context.xml[tags=e1] + <!-- camelContext is the Camel runtime, where we can host Camel routes --> + <camelContext xmlns="http://camel.apache.org/schema/spring"> + <route> + <!-- read input from the console using the stream component --> + <from uri="stream:in?promptMessage=Enter something: "/> + <!-- transform the input to upper case using the simple language --> + <!-- you can also use other languages such as groovy, ognl, mvel, javascript etc. --> + <transform> + <simple>${body.toUpperCase()}</simple> + </transform> + <!-- and then print to the console --> + <to uri="stream:out"/> + </route> + </camelContext> + ---- This example can be launched from the command line using Maven: diff --git a/docs/user-manual/modules/ROOT/pages/walk-through-an-example.adoc b/docs/user-manual/modules/ROOT/pages/walk-through-an-example.adoc index 1aafa7e..a3a92e6 100644 --- a/docs/user-manual/modules/ROOT/pages/walk-through-an-example.adoc +++ b/docs/user-manual/modules/ROOT/pages/walk-through-an-example.adoc @@ -16,7 +16,7 @@ etc: [source,java] ---- -include::{examplesdir}/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java[tags=e1] + CamelContext context = new DefaultCamelContext(); ---- There is more than one way of adding a Component to the CamelContext. You can @@ -26,14 +26,20 @@ xref:components::file-component.adoc[FileComponent]: [source,java] ---- -include::{examplesdir}/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java[tags=e3] +context.addRoutes(new RouteBuilder() { + public void configure() { + from("test-jms:queue:test.queue").to("file://test"); + } + }); ---- or explicitly - as we do here when we add the JMS Component: [source,java] ---- -include::{examplesdir}/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java[tags=e2] +ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false"); + // Note we can explicit name the component + context.addComponent("test-jms", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory)); ---- or explicitly using the Component DSL which allows you to configure the components using DSL APIs and register them to the camel context. First you will have the import the maven package for the Component DSL: @@ -73,7 +79,7 @@ configuration: [source,java] ---- -include::{examplesdir}/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java[tags=e4] +ProducerTemplate template = context.createProducerTemplate(); ---- Next you *must* start the camel context. If you are using @@ -94,7 +100,9 @@ camel: [source,java] ---- -include::{examplesdir}/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/CamelJmsToFileExample.java[tags=e5] +for (int i = 0; i < 10; i++) { + template.sendBody("test-jms:queue:test.queue", "Test Message: " + i); +} ---- == What happens?