You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2021/02/01 15:16:51 UTC

[camel-k] branch master updated: refactor(examples): organize in folders

This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/master by this push:
     new b75fb6d  refactor(examples): organize in folders
b75fb6d is described below

commit b75fb6d8d501e79eb7ce084f185bf05188f23484
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Mon Feb 1 12:02:25 2021 +0100

    refactor(examples): organize in folders
    
    * Introduced a folder structure in order to keep examples organized
    * Added a main index page with link to each section
---
 examples/README.md                               | 41 +++++++++++++++++++++++-
 examples/{ => amqp}/AMQPBindToRegistry.java      |  0
 examples/amqp/README.md                          |  3 ++
 examples/{ => amqp}/amqp.groovy                  |  0
 examples/{ => amqp}/amqp.js                      |  0
 examples/{ => amqp}/amqpConsume.java             |  0
 examples/basic/README.md                         |  3 ++
 examples/{ => basic}/cron.groovy                 |  0
 examples/{ => basic}/props.js                    |  0
 examples/{ => basic}/resources-data.txt          |  0
 examples/{ => basic}/resources-route.groovy      |  0
 examples/{ => caffeine}/CaffeineCacheSample.java |  0
 examples/caffeine/README.md                      |  3 ++
 examples/{ => caffeine}/camel-caffeine.groovy    |  0
 examples/dns/README.md                           |  3 ++
 examples/{ => dns}/dns.js                        |  0
 examples/kafka/{README.adoc => README.md}        |  3 +-
 examples/kamelets/README.md                      |  3 ++
 examples/knative/{README.adoc => README.md}      | 14 ++++----
 examples/languages/README.md                     |  3 ++
 examples/{ => languages}/Sample.java             |  0
 examples/{ => languages}/hello.xml               |  0
 examples/{ => languages}/routes.yaml             |  0
 examples/{ => languages}/simple.groovy           |  0
 examples/{ => languages}/simple.js               |  0
 examples/{ => master}/Master.java                |  0
 examples/master/README.md                        |  3 ++
 examples/modeline/README.md                      |  3 ++
 examples/{ => modeline}/SampleModeline.java      |  0
 examples/openapi/README.md                       |  3 ++
 examples/{ => openapi}/greetings-api.json        |  0
 examples/{ => openapi}/greetings.groovy          |  0
 examples/{ => openapi}/petstore-api.yaml         |  0
 examples/{ => openapi}/petstore.groovy           |  0
 examples/polyglot/README.adoc                    |  8 -----
 examples/polyglot/README.md                      |  7 ++++
 examples/processor/README.md                     |  3 ++
 examples/{ => processor}/kotlin-routes.kts       |  0
 examples/{ => processor}/routes.groovy           |  0
 examples/{ => processor}/routes.js               |  0
 examples/pulsar/README.md                        |  3 ++
 examples/{ => pulsar}/pulsar.groovy              |  0
 examples/rest/README.md                          |  3 ++
 examples/{ => rest}/RestDSL.java                 |  0
 examples/{ => rest}/routes-rest.js               |  0
 examples/saga/{Readme.md => README.md}           |  2 +-
 examples/tekton/README.md                        |  2 +-
 47 files changed, 92 insertions(+), 21 deletions(-)

diff --git a/examples/README.md b/examples/README.md
index 89fdbe8..239916c 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -1,3 +1,42 @@
 # Camel K Examples
 
-This folder contains examples of Camel K integrations defined in various languages.
\ No newline at end of file
+This folder contains various examples of `Camel K` integrations. You can use them to learn more about the capabilities of Camel K or to inspire your integration development.
+
+## Basic usage examples
+
+In this section you will find the most basic examples. Useful to start learning about Camel K and how to run. You can use many supported languages and learn about the most basic features:
+
+| Type  |  Description | Link  |
+|---|---|---|
+| Languages | Simple integrations developed in various supported languages | [see examples](./languages/)|
+| Basic | Basic features such as `cron`, `properties` or `resource`s | [see examples](./basic/)|
+| Processor | Show how to include `Processor`s logic | [see examples](./processor/)|
+| Open API | `Open API` support | [see examples](./openapi/)|
+| Rest | Produce/Consume `REST`ful services | [see examples](./rest/)|
+| Modeline | [Camel K modeline support](https://camel.apache.org/camel-k/latest/cli/modeline.html) | [see examples](./modeline/)|
+
+## Component usage examples
+
+In this section you can find a few examples of certain [`Camel` components](https://camel.apache.org/components/latest/index.html). This is a limited number of the wide variety of components supported by Apache Camel. You can also find useful examples [in this repository](https://github.com/apache/camel-k-examples).
+
+
+| Type  |  Description | Link  |
+|---|---|---|
+| AMQP | Component usage | [see examples](./amqp/)|
+| Caffeine | Component usage | [see examples](./caffeine/)|
+| DNS | Component usage | [see examples](./dns/)|
+| Kafka | Component usage | [see examples](./kafka/)|
+| Knative | Component usage | [see examples](./knative/)|
+
+## Advanced usage examples
+
+As soon as you will learn the basic stuff, you will like to try the new advanced feature offered by Camel K. Here a few examples:
+
+| Type  |  Description | Link  |
+|---|---|---|
+| Kamelets | How to use [`Kamelet`s](https://camel.apache.org/camel-k/latest/kamelets/kamelets.html) | [see examples](./kamelets/)|
+| Master | Master support example | [see examples](./master/)|
+| Polyglot | Polyglot integration examples | [see examples](./polyglot/)|
+| Pulsar | Pulsar usage | [see examples](./pulsar/)|
+| Saga | Saga pattern example | [see examples](./saga/)|
+| Tekton | Tekton tutorial | [see examples](./tekton/)|
\ No newline at end of file
diff --git a/examples/AMQPBindToRegistry.java b/examples/amqp/AMQPBindToRegistry.java
similarity index 100%
rename from examples/AMQPBindToRegistry.java
rename to examples/amqp/AMQPBindToRegistry.java
diff --git a/examples/amqp/README.md b/examples/amqp/README.md
new file mode 100644
index 0000000..0175945
--- /dev/null
+++ b/examples/amqp/README.md
@@ -0,0 +1,3 @@
+# AMQP Camel K examples
+
+Find useful examples about how to use AMQP in a Camel K integration.
\ No newline at end of file
diff --git a/examples/amqp.groovy b/examples/amqp/amqp.groovy
similarity index 100%
rename from examples/amqp.groovy
rename to examples/amqp/amqp.groovy
diff --git a/examples/amqp.js b/examples/amqp/amqp.js
similarity index 100%
rename from examples/amqp.js
rename to examples/amqp/amqp.js
diff --git a/examples/amqpConsume.java b/examples/amqp/amqpConsume.java
similarity index 100%
rename from examples/amqpConsume.java
rename to examples/amqp/amqpConsume.java
diff --git a/examples/basic/README.md b/examples/basic/README.md
new file mode 100644
index 0000000..721f701
--- /dev/null
+++ b/examples/basic/README.md
@@ -0,0 +1,3 @@
+# Basic Camel K examples
+
+Find useful examples about how to use certain basic features of Camel K.
\ No newline at end of file
diff --git a/examples/cron.groovy b/examples/basic/cron.groovy
similarity index 100%
rename from examples/cron.groovy
rename to examples/basic/cron.groovy
diff --git a/examples/props.js b/examples/basic/props.js
similarity index 100%
rename from examples/props.js
rename to examples/basic/props.js
diff --git a/examples/resources-data.txt b/examples/basic/resources-data.txt
similarity index 100%
rename from examples/resources-data.txt
rename to examples/basic/resources-data.txt
diff --git a/examples/resources-route.groovy b/examples/basic/resources-route.groovy
similarity index 100%
rename from examples/resources-route.groovy
rename to examples/basic/resources-route.groovy
diff --git a/examples/CaffeineCacheSample.java b/examples/caffeine/CaffeineCacheSample.java
similarity index 100%
rename from examples/CaffeineCacheSample.java
rename to examples/caffeine/CaffeineCacheSample.java
diff --git a/examples/caffeine/README.md b/examples/caffeine/README.md
new file mode 100644
index 0000000..0be603f
--- /dev/null
+++ b/examples/caffeine/README.md
@@ -0,0 +1,3 @@
+# Caffeine Camel K examples
+
+Find useful examples about how to use Caffeine in a Camel K integration.
\ No newline at end of file
diff --git a/examples/camel-caffeine.groovy b/examples/caffeine/camel-caffeine.groovy
similarity index 100%
rename from examples/camel-caffeine.groovy
rename to examples/caffeine/camel-caffeine.groovy
diff --git a/examples/dns/README.md b/examples/dns/README.md
new file mode 100644
index 0000000..301ee94
--- /dev/null
+++ b/examples/dns/README.md
@@ -0,0 +1,3 @@
+# DNS Camel K examples
+
+Find useful examples about how to use DNS in a Camel K integration.
\ No newline at end of file
diff --git a/examples/dns.js b/examples/dns/dns.js
similarity index 100%
rename from examples/dns.js
rename to examples/dns/dns.js
diff --git a/examples/kafka/README.adoc b/examples/kafka/README.md
similarity index 94%
rename from examples/kafka/README.adoc
rename to examples/kafka/README.md
index aa38cf4..d92fbca 100644
--- a/examples/kafka/README.adoc
+++ b/examples/kafka/README.md
@@ -1,5 +1,4 @@
-Kafka Example (Apache Camel K)
-==============================
+# Kafka Camel K examples
 
 This example shows how Camel K can be used to connect to a Kafka broker.
 
diff --git a/examples/kamelets/README.md b/examples/kamelets/README.md
new file mode 100644
index 0000000..819f173
--- /dev/null
+++ b/examples/kamelets/README.md
@@ -0,0 +1,3 @@
+# Kamelets Camel K examples
+
+Find useful examples about how to use Kamelets.
\ No newline at end of file
diff --git a/examples/knative/README.adoc b/examples/knative/README.md
similarity index 96%
rename from examples/knative/README.adoc
rename to examples/knative/README.md
index 18d0d7a..0c856e2 100644
--- a/examples/knative/README.adoc
+++ b/examples/knative/README.md
@@ -1,6 +1,4 @@
-Knative Example (Apache Camel K)
-================================
-
+# Knative Camel K Example
 This example shows how Camel K can be used to connect Knative building blocks to create awesome applications.
 
 A video version of this https://youtu.be/btf_e2GniXM[demo is available on YouTube].
@@ -23,7 +21,7 @@ kubectl create -f words-channel.yaml
 
 We can now proceed to install all camel K integrations.
 
-== Install a "Printer"
+## Install a "Printer"
 
 We'll install a Camel K integration that will print all words from the `words` channel.
 
@@ -48,7 +46,7 @@ Under the hood, the Camel K operator does this:
 
 The resulting integration will be scaled to 0 when not used (if you wait ~5 minutes, you'll see it).
 
-== Install a "Splitter"
+## Install a "Splitter"
 
 We're now going to deploy a splitter, using the Camel core Split EIP. The splitter will take all messages from the `messages` channel,
 split them and push the single words into the `words` channel.
@@ -70,7 +68,7 @@ kamel run splitter.groovy
 
 This integration will be also materialized as a Knative autoscaling service, because the only entrypoint is passive (waits for a push notification).
 
-== Install a "Feed"
+## Install a "Feed"
 
 We're going to feed this chain of functions using a timed feed like this:
 
@@ -92,7 +90,7 @@ kamel run feed.groovy
 This cannot be materialized into an autoscaling service, but the operator understands it automatically and maps it to a plain Kubernetes Deployment
 (Istio sidecar will be injected).
 
-== Playing around
+## Playing around
 
 If you've installed all the services, you'll find that the printer pod will print single words as they arrive from the feed (every 3 seconds, passing by the splitter function).
 
@@ -100,7 +98,7 @@ If you now stop the feed integration (`kamel delete feed`) you will notice that
 
 And if you reinstall the feed again (`kamel run feed.groovy`), the other integration will scale up again as soon as they receive messages (splitter first, then printer).
 
-== Playing harder
+## Playing harder
 
 You can also play with different kind of feeds. E.g. the following simple feed can be used to bind messages from Telegram to the system:
 
diff --git a/examples/languages/README.md b/examples/languages/README.md
new file mode 100644
index 0000000..1d70af4
--- /dev/null
+++ b/examples/languages/README.md
@@ -0,0 +1,3 @@
+# Supported languages Camel K examples
+
+Find useful examples about how to develop a Camel K integration in `Java`, `Javascript`, `Groovy`, `XML` and `YAML`.
\ No newline at end of file
diff --git a/examples/Sample.java b/examples/languages/Sample.java
similarity index 100%
rename from examples/Sample.java
rename to examples/languages/Sample.java
diff --git a/examples/hello.xml b/examples/languages/hello.xml
similarity index 100%
rename from examples/hello.xml
rename to examples/languages/hello.xml
diff --git a/examples/routes.yaml b/examples/languages/routes.yaml
similarity index 100%
rename from examples/routes.yaml
rename to examples/languages/routes.yaml
diff --git a/examples/simple.groovy b/examples/languages/simple.groovy
similarity index 100%
rename from examples/simple.groovy
rename to examples/languages/simple.groovy
diff --git a/examples/simple.js b/examples/languages/simple.js
similarity index 100%
rename from examples/simple.js
rename to examples/languages/simple.js
diff --git a/examples/Master.java b/examples/master/Master.java
similarity index 100%
rename from examples/Master.java
rename to examples/master/Master.java
diff --git a/examples/master/README.md b/examples/master/README.md
new file mode 100644
index 0000000..1101805
--- /dev/null
+++ b/examples/master/README.md
@@ -0,0 +1,3 @@
+# Master Camel K examples
+
+Find useful examples about how to use Master in a Camel K integration.
\ No newline at end of file
diff --git a/examples/modeline/README.md b/examples/modeline/README.md
new file mode 100644
index 0000000..922833a
--- /dev/null
+++ b/examples/modeline/README.md
@@ -0,0 +1,3 @@
+# Modeline Camel K examples
+
+Find useful examples about how to use Modeline in a Camel K integration.
\ No newline at end of file
diff --git a/examples/SampleModeline.java b/examples/modeline/SampleModeline.java
similarity index 100%
rename from examples/SampleModeline.java
rename to examples/modeline/SampleModeline.java
diff --git a/examples/openapi/README.md b/examples/openapi/README.md
new file mode 100644
index 0000000..41193d7
--- /dev/null
+++ b/examples/openapi/README.md
@@ -0,0 +1,3 @@
+# Open API Camel K examples
+
+Find useful examples about how to expose an Open API specification in a Camel K integration.
\ No newline at end of file
diff --git a/examples/greetings-api.json b/examples/openapi/greetings-api.json
similarity index 100%
rename from examples/greetings-api.json
rename to examples/openapi/greetings-api.json
diff --git a/examples/greetings.groovy b/examples/openapi/greetings.groovy
similarity index 100%
rename from examples/greetings.groovy
rename to examples/openapi/greetings.groovy
diff --git a/examples/petstore-api.yaml b/examples/openapi/petstore-api.yaml
similarity index 100%
rename from examples/petstore-api.yaml
rename to examples/openapi/petstore-api.yaml
diff --git a/examples/petstore.groovy b/examples/openapi/petstore.groovy
similarity index 100%
rename from examples/petstore.groovy
rename to examples/openapi/petstore.groovy
diff --git a/examples/polyglot/README.adoc b/examples/polyglot/README.adoc
deleted file mode 100644
index 9600f5a..0000000
--- a/examples/polyglot/README.adoc
+++ /dev/null
@@ -1,8 +0,0 @@
-= Example of route built using multiple DSLs
-
-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/README.md b/examples/polyglot/README.md
new file mode 100644
index 0000000..07072cf
--- /dev/null
+++ b/examples/polyglot/README.md
@@ -0,0 +1,7 @@
+# Polyglot Camel K examples
+
+Run an integration using different Camel DSL languages.
+
+```
+$ kamel run --name polyglot routes.xml beans.groovy JavaRoute.java
+```
\ No newline at end of file
diff --git a/examples/processor/README.md b/examples/processor/README.md
new file mode 100644
index 0000000..558280a
--- /dev/null
+++ b/examples/processor/README.md
@@ -0,0 +1,3 @@
+# Processors Camel K examples
+
+Find useful examples about how to include a `Processor` in a Camel K integration.
\ No newline at end of file
diff --git a/examples/kotlin-routes.kts b/examples/processor/kotlin-routes.kts
similarity index 100%
rename from examples/kotlin-routes.kts
rename to examples/processor/kotlin-routes.kts
diff --git a/examples/routes.groovy b/examples/processor/routes.groovy
similarity index 100%
rename from examples/routes.groovy
rename to examples/processor/routes.groovy
diff --git a/examples/routes.js b/examples/processor/routes.js
similarity index 100%
rename from examples/routes.js
rename to examples/processor/routes.js
diff --git a/examples/pulsar/README.md b/examples/pulsar/README.md
new file mode 100644
index 0000000..025150d
--- /dev/null
+++ b/examples/pulsar/README.md
@@ -0,0 +1,3 @@
+# Pulsar Camel K examples
+
+Find useful examples about how to use Pulsar in a Camel K integration.
\ No newline at end of file
diff --git a/examples/pulsar.groovy b/examples/pulsar/pulsar.groovy
similarity index 100%
rename from examples/pulsar.groovy
rename to examples/pulsar/pulsar.groovy
diff --git a/examples/rest/README.md b/examples/rest/README.md
new file mode 100644
index 0000000..ef29433
--- /dev/null
+++ b/examples/rest/README.md
@@ -0,0 +1,3 @@
+# Rest Camel K examples
+
+Find useful examples about how to Produce/Consume RESTful webservices in a Camel K integration.
\ No newline at end of file
diff --git a/examples/RestDSL.java b/examples/rest/RestDSL.java
similarity index 100%
rename from examples/RestDSL.java
rename to examples/rest/RestDSL.java
diff --git a/examples/routes-rest.js b/examples/rest/routes-rest.js
similarity index 100%
rename from examples/routes-rest.js
rename to examples/rest/routes-rest.js
diff --git a/examples/saga/Readme.md b/examples/saga/README.md
similarity index 98%
rename from examples/saga/Readme.md
rename to examples/saga/README.md
index 7debc1f..56ba1f4 100644
--- a/examples/saga/Readme.md
+++ b/examples/saga/README.md
@@ -1,4 +1,4 @@
-# Saga example
+# Saga Camel K examples
 
 This example is from [camel-saga-quickstart](https://github.com/nicolaferraro/camel-saga-quickstart/) adapted to work with camel-k.
 
diff --git a/examples/tekton/README.md b/examples/tekton/README.md
index 86d1e87..c386ba9 100644
--- a/examples/tekton/README.md
+++ b/examples/tekton/README.md
@@ -1,4 +1,4 @@
-# Example: Camel K in Tekton Pipelines
+# Camel K in Tekton Pipelines
 
 This example is part of a tutorial about running Camel K on Tekton pipelines.