nicolaferraro commented on a change in pull request #2217: URL: https://github.com/apache/camel-k/pull/2217#discussion_r614698725
########## File path: pkg/controller/kameletbinding/common.go ########## @@ -129,21 +145,38 @@ func createIntegrationFor(ctx context.Context, c client.Client, kameletbinding * "to": to.URI, }) - flow := map[string]interface{}{ + flowFrom := map[string]interface{}{ "from": map[string]interface{}{ "uri": from.URI, "steps": dslSteps, }, } - encodedFlow, err := json.Marshal(flow) + encodedFrom, err := json.Marshal(flowFrom) if err != nil { return nil, err } - it.Spec.Flows = append(it.Spec.Flows, v1.Flow{RawMessage: encodedFlow}) + it.Spec.Flows = append(it.Spec.Flows, v1.Flow{RawMessage: encodedFrom}) return &it, nil } +func setErrorHandlerKamelet(errorHandler *bindings.Binding, kameletSpec v1alpha1.Endpoint) error { Review comment: Ok, I think I got the way you're implementing this and I had a slightly different idea in mind. The runtime part should still be ok. In your model, the error hander is a special type of Kamelet, while I was thinking we don't need another type of Kamelet, we can potentially set any Kamelet of type sink as error handler. In the model I'm describing, the error handler is a source that the operator adds to the list of "generated sources" in the integration status, possibly pointing to a standard Kamelet from the catalog. This allows for example setting this binding: ```yaml # ... spec: source: # ... sink: # ... errorHandler: ref: type: Kamelet apiVersion: camel.apache.org/v1alpha1 name: dropbox-sink ``` From a user point of view, it means "store errors as files on dropbox", which seems natural. But also, this allows setting something like: ```yaml spec: # ... errorHandler: ref: type: Channel apiVersion: messaging.knative.dev/v1 name: dead-letter-channel ``` I.e. "redirect errors to a Knative channel as-they-are". This may work the following way, more or less: 1. The kameletbinding controller detects we want to use an error handler 2. The pkg/util/binding package contains methods for converting the `ref` + `properties` of the `errorHandler` definition into a Camel URI 3. The kameletbinding controller adds a generated source of type error-handler that forwards data in the URI determined at previous step 4. The pkg/metadata package should be instructed to detect URIs also in error handler definitions: this way the Kamelet trait will load the Kamelet as a standard sink-type kamelet (if you're using it, or do nothing if you're using e.g. a Knative channel as dead letter channel) and the error handler will point to it Wdyt? cc: @lburgazzoli -- 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