This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-kamelets-examples.git
The following commit(s) were added to refs/heads/main by this push: new daf43f6 Add error handler example daf43f6 is described below commit daf43f68dc0c532788a8b93fd19c4e8d7c065daa Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Mon Dec 12 21:53:05 2022 +0100 Add error handler example --- jbang/error-handler/README.adoc | 60 ++++++++++++++++++++++++++++++ jbang/error-handler/foo-configuration.yaml | 11 ++++++ jbang/error-handler/foo.yaml | 11 ++++++ 3 files changed, 82 insertions(+) diff --git a/jbang/error-handler/README.adoc b/jbang/error-handler/README.adoc new file mode 100644 index 0000000..1de292b --- /dev/null +++ b/jbang/error-handler/README.adoc @@ -0,0 +1,60 @@ +== Error Handler + +This example shows in YAML DSL how to use route configuration to setup error handling. + +=== Install JBang + +First install JBang according to https://www.jbang.dev + +When JBang is installed then you should be able to run from a shell: + +[source,sh] +---- +$ jbang --version +---- + +This will output the version of JBang. + +To run this example you can either install Camel on JBang via: + +[source,sh] +---- +$ jbang app install camel@apache/camel +---- + +Which allows to run CamelJBang with `camel` as shown below. + +=== How to run + +Then you can run this example using: + +[source,sh] +---- +$ camel run * +---- + +Or run with JBang using the longer command line (without installing camel as app in JBang): + +[source,sh] +---- +$ jbang camel@apache/camel run * +---- + +=== Run directly from github + +The example can also be run directly by referring to the github URL as shown: + +[source,sh] +---- +$ jbang camel@apache/camel run https://github.com/apache/camel-kamelets-examples/tree/main/jbang/error-handler +---- + +=== Help and contributions + +If you hit any problem using Camel or have some feedback, then please +https://camel.apache.org/community/support/[let us know]. + +We also love contributors, so +https://camel.apache.org/community/contributing/[get involved] :-) + +The Camel riders! diff --git a/jbang/error-handler/foo-configuration.yaml b/jbang/error-handler/foo-configuration.yaml new file mode 100644 index 0000000..48b7db6 --- /dev/null +++ b/jbang/error-handler/foo-configuration.yaml @@ -0,0 +1,11 @@ +# camel-k: language=yaml + +# route configuration + +- route-configuration: + error-handler: + dead-letter-channel: + deadLetterUri: "log:dead" + redeliveryPolicy: + maximumRedeliveries: 5 + retryAttemptedLogLevel: WARN diff --git a/jbang/error-handler/foo.yaml b/jbang/error-handler/foo.yaml new file mode 100644 index 0000000..3001ef6 --- /dev/null +++ b/jbang/error-handler/foo.yaml @@ -0,0 +1,11 @@ +# camel-k: language=yaml + +# Write your routes here, for example: +- from: + uri: "timer:yaml" + parameters: + period: "1000" + steps: + - throwException: + exceptionType: "java.lang.IllegalArgumentException" + message: "Forced error"