Raymond created CAMEL-22731:
-------------------------------

             Summary: Add enabled to route node
                 Key: CAMEL-22731
                 URL: https://issues.apache.org/jira/browse/CAMEL-22731
             Project: Camel
          Issue Type: Improvement
    Affects Versions: 4.16.0
            Reporter: Raymond


Though maybe not so well documented, route nodes can be disabled. This is 
useful when for example temporary you don't want to use a certain node.

I use this principle in Kamelets. This allows me to have various parts in one 
Kamelet route that can be enabled with a boolean property on the Kamelet.

Here is an example:

- choice:
  disabled: "\{{useThisFunction}}"
  when:
    - simple: "${header.ASSIMBLY_RetryAttempts} == null"
      steps:
        - setProperty:
            name: "ASSIMBLY_originalHttpMessageMethod"
            constant: SET
        - process:
            ref: SetOriginalMessageProcessor

This works as intended. However, the thing is from a low-code tool there are 
on/off toggle switch where a user can enable a function or not. But because 
true disables it, the question is:

_Set to false to enable function X_
A solution could be that when enabled (true) on the frontend then send it as 
false to the backend (Camel), but this doesn't make sense to me.

Would it be possible to use a NOT operator in Kamelets:

- choice:
  disabled: "\{{!useThisFunction}}"

Or add a positive enabled to a route (default is true)

- choice:
  enabled: "\{{useThisFunction}}"

Note it's already possible to do \{{?useThisFunction}} for null values, and as 
a boolean is a primitive it cannot be null anyway. __ 






 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to