nicolaferraro commented on a change in pull request #2217: URL: https://github.com/apache/camel-k/pull/2217#discussion_r621232396
########## File path: docs/modules/traits/pages/error-handler.adoc ########## @@ -0,0 +1,36 @@ += Error Handler Trait + +// Start of autogenerated code - DO NOT EDIT! (description) +The error-handler is a platform trait used to inject Error Handler source into the integration runtime. + + +This trait is available in the following profiles: **Kubernetes, Knative, OpenShift**. + +WARNING: The error-handler trait is a *platform trait*: disabling it may compromise the platform functionality. + +// End of autogenerated code - DO NOT EDIT! (description) +// Start of autogenerated code - DO NOT EDIT! (configuration) +== Configuration + +Trait properties can be specified when running any integration with the CLI: +[source,console] +---- +$ kamel run --trait error-handler.[key]=[value] --trait error-handler.[key2]=[value2] integration.groovy +---- +The following configuration options are available: + +[cols="2m,1m,5a"] +|=== +|Property | Type | Description + +| error-handler.enabled +| bool +| Can be used to enable or disable a trait. All traits share this common property. + +| error-handler.,omitempty Review comment: Seems there's a problem here ########## File path: examples/kamelets/error-handler/error-handler.kamelet.yaml ########## @@ -0,0 +1,41 @@ +# --------------------------------------------------------------------------- +# 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. +# --------------------------------------------------------------------------- + +apiVersion: camel.apache.org/v1alpha1 +kind: Kamelet +metadata: + name: error-handler +spec: + definition: + title: "Error Log Sink" + description: "Consume events from a channel" Review comment: Wrong desc ########## File path: deploy/olm-catalog/camel-k-dev/1.4.0/camel.apache.org_integrations.yaml ########## @@ -88,6 +88,21 @@ spec: items: type: string type: array + errorHandler: Review comment: After reading the PR, this seems something from previous attempts... ########## File path: examples/kamelets/error-handler/incremental-id-source.kamelet.yaml ########## @@ -0,0 +1,51 @@ +# --------------------------------------------------------------------------- +# 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. +# --------------------------------------------------------------------------- + +apiVersion: camel.apache.org/v1alpha1 +kind: Kamelet +metadata: + name: incremental-id-source + labels: + camel.apache.org/kamelet.type: "source" +spec: + definition: + title: "Incremental ID Source" + description: "Produces periodic events with an incremental ID" Review comment: .. and fails when the ID contains "0" ########## File path: deploy/olm-catalog/camel-k-dev/1.4.0/camel.apache.org_integrations.yaml ########## @@ -88,6 +88,21 @@ spec: items: type: string type: array + errorHandler: Review comment: Does it needs to be a top level property on the integration? I see there's a source of type "errorHandler" that can be added. Also, you're updating the OLM manifest for 1.4.0 which is already released (I plan to only keep latest from now on btw, so it's not a real issue) ########## File path: examples/kamelets/error-handler/error-handler.kamelet.yaml ########## @@ -0,0 +1,41 @@ +# --------------------------------------------------------------------------- +# 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. +# --------------------------------------------------------------------------- + +apiVersion: camel.apache.org/v1alpha1 +kind: Kamelet +metadata: + name: error-handler +spec: + definition: + title: "Error Log Sink" + description: "Consume events from a channel" + required: + - message + properties: + message: + title: Message + description: The message to log + type: string + example: "error while checking the source" + flow: + from: + uri: kamelet:source + steps: +# - to: my-dlc Review comment: ```suggestion ``` ########## File path: pkg/apis/camel/v1/integration_types_support.go ########## @@ -131,6 +131,19 @@ func (in *IntegrationSpec) AddDependency(dependency string) { in.Dependencies = append(in.Dependencies, newDep) } +// GetConfigurationProperty returns a configuration property +func (in *IntegrationSpec) GetConfigurationProperty(property string) string { + for _, confSpec := range in.Configuration { + if confSpec.Type == "property" && strings.HasPrefix(confSpec.Value, property) { + splitConf := strings.Split(confSpec.Value, "=") + if len(splitConf) > 0 { Review comment: ```suggestion if len(splitConf) > 1 { ``` (don't know if "=" at the end of property returns 1 or 2 elements, but this does not panic) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org