Raymond created CAMEL-22958:
-------------------------------

             Summary: Use disabled with String values
                 Key: CAMEL-22958
                 URL: https://issues.apache.org/jira/browse/CAMEL-22958
             Project: Camel
          Issue Type: Improvement
    Affects Versions: 4.17.0
            Reporter: Raymond


Currently, it's possible to disable an EIP (or other kind of part of the route) 
with a disabled=true.

For example:


{code:java}
- choice:
    disabled: "{{!retryRequests}}"
    when:
    - simple: "${header.RetryAttempts} == null"
      steps:
      - setProperty:
          name: "HttpMessageMethod"
          constant: "SET"
      - process:
          ref: "SetOriginalMessageProcessor" {code}

In Kamelets/Templates this is very practical, because you can use boolean 
properties to disable/enable a part of the route, without making a new template 
or checking the condition in runtime.

The issue I have is that often the property to check is not a boolean, but a 
String value (often some enumeration). So then I have a property with the 
values "A", "B", "C". Sometimes I added a boolean property, but especially with 
a larger list or more possible values, this is not very practical.

Could there be a new option to disable/enable an EIP with a String value? 
Something like:


{code:java}
- choice:
    disabled: 
      property: "{{myProperty}}"
      hasValue: "A" {code}

Which would basically just do under the hood
{code:java}
property.equals("A"){code}
.
As the property can have a lot of values, then you also need 


{code:java}
- choice:
   disabled: 
     property: "{{myProperty}}"
     hasNotValue: "A"  {code}

or (without the double negation)


{code:java}
- choice:
   enabled: 
     property: "{{myProperty}}"
     hasValue: "A" {code}
















 



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

Reply via email to