[GitHub] [camel-k-runtime] lburgazzoli opened a new issue #560: camel-kamelet: rimprove global property handling

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] [camel-k-runtime] lburgazzoli opened a new issue #560: camel-kamelet: rimprove global property handling

GitBox

lburgazzoli opened a new issue #560:
URL: https://github.com/apache/camel-k-runtime/issues/560


   The way the `kamelet` component handles properties as today is:
   
   ```
   camel.kamelet.${templateId}
   camel.kamelet.${templateId}.${routeId}
   ```
   
   But there are some issue with that:
   
   1. the `routeId` may be confusing as it can be used for setting a template property and as a root for the materialized route properties
   2. it uses a non standard prefix as all the component use `camel.component.${scheme}`
   
   A possible alternative is to to leverage camel's capabilities to use map, something like:
   
   ```
   camel.component.kamelet.template-properties[${templateId}][foo] = bar
   camel.component.kamelet.route-properties[${routeId}][foo] = bar
   ```
   
   However it looks quite ugly, a better way would be:
   
   ```
   camel.component.kamelet.template-properties[${templateId}].foo = bar
   camel.component.kamelet.route-properties[${routeId}].foo = bar
   ```
   
   But I don't think camel is currently able to handle this case so we should probably enhance the properties binding support, as example we can mark a component to be `PropertiesAware` so the binding process should not try to bind the entire object tree but it delegates the mapping to the receiver object.
   
   ```java
   public interface PropertiesAware {
       void setProperties(Map<String, String> properties);
       Map<String, String> properties getProperties(Map<String, String> properties);
   }
   ```
   
   Assuming the component would have been something like:
   
   ```java
   public class KameletComponent extends DefaultComponent {
       private Map<String, PropertiesHolder> templateProperties;
       private Map<String, PropertiesHolder> routeProperties;
   
       // getter/Setter omitted
   }
   
   public class PropertiesHolder implements PropertiesAware {
       @Override
       public void setProperties(Map<String, String> properties) { ... }
       @Override
       public Map<String, String> properties getProperties(Map<String, String> properties) { ... }
   }
   ```
   
   The binding process then can stop at `camel.component.kamelet.template-properties[${templateId}]` and `
   camel.component.kamelet.route-properties[${routeId}]` and any further processing should be eventually done by the receiver.
   
   @davsclaus does this make any sense ?


----------------------------------------------------------------
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:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [camel-k-runtime] davsclaus commented on issue #560: camel-kamelet: rimprove global property handling

GitBox

davsclaus commented on issue #560:
URL: https://github.com/apache/camel-k-runtime/issues/560#issuecomment-731616829


   On top of my head there is some components that have property prefix, like camel-http with http client options
   https://github.com/apache/camel/blob/master/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java#L406
   
   Maybe we could have something like that, then its
   
   ```
   camel.component.kamelet.template-properties.myTemplate.foo = bar
   camel.component.kamelet.template-properties.myTemplate.code = 1234
   camel.component.kamelet.route-properties.myRoute.foo = bar
   ```
   
   Then `template-properties` and `route-properties` are just a Map which we then use that extract code (see link above) and in the kamelet component we can then do the binding we want.


----------------------------------------------------------------
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:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [camel-k-runtime] davsclaus edited a comment on issue #560: camel-kamelet: rimprove global property handling

GitBox
In reply to this post by GitBox

davsclaus edited a comment on issue #560:
URL: https://github.com/apache/camel-k-runtime/issues/560#issuecomment-731616829


   On top of my head there is some components that have property prefix, like camel-http with http client options
   https://github.com/apache/camel/blob/master/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java#L406
   
   (mind that the http component is one of the more complex component for this kind) I think rabbitmq and some others have a bit simpler code for this option prefix options.
   
   Maybe we could have something like that, then its
   
   ```
   camel.component.kamelet.template-properties.myTemplate.foo = bar
   camel.component.kamelet.template-properties.myTemplate.code = 1234
   camel.component.kamelet.route-properties.myRoute.foo = bar
   ```
   
   Then `template-properties` and `route-properties` are just a Map which we then use that extract code (see link above) and in the kamelet component we can then do the binding we want.


----------------------------------------------------------------
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:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [camel-k-runtime] lburgazzoli commented on issue #560: camel-kamelet: rimprove global property handling

GitBox
In reply to this post by GitBox

lburgazzoli commented on issue #560:
URL: https://github.com/apache/camel-k-runtime/issues/560#issuecomment-731628701


   oh, that's cool.  will test it


----------------------------------------------------------------
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:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [camel-k-runtime] lburgazzoli edited a comment on issue #560: camel-kamelet: rimprove global property handling

GitBox
In reply to this post by GitBox

lburgazzoli edited a comment on issue #560:
URL: https://github.com/apache/camel-k-runtime/issues/560#issuecomment-731628701


   oh, that's cool.  yes that would do what I'm looking for


----------------------------------------------------------------
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:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [camel-k-runtime] lburgazzoli edited a comment on issue #560: camel-kamelet: rimprove global property handling

GitBox
In reply to this post by GitBox

lburgazzoli edited a comment on issue #560:
URL: https://github.com/apache/camel-k-runtime/issues/560#issuecomment-731628701


   oh, that's cool and yes that would do what I'm looking for


----------------------------------------------------------------
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:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [camel-k-runtime] lburgazzoli commented on issue #560: camel-kamelet: rimprove global property handling

GitBox
In reply to this post by GitBox

lburgazzoli commented on issue #560:
URL: https://github.com/apache/camel-k-runtime/issues/560#issuecomment-732131371


   @davsclaus do you think we can have something for this in 3.7 ?


----------------------------------------------------------------
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:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [camel-k-runtime] davsclaus commented on issue #560: camel-kamelet: rimprove global property handling

GitBox
In reply to this post by GitBox

davsclaus commented on issue #560:
URL: https://github.com/apache/camel-k-runtime/issues/560#issuecomment-732138986


   Yeah have you tried that extract property thingy?


----------------------------------------------------------------
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:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [camel-k-runtime] davsclaus edited a comment on issue #560: camel-kamelet: rimprove global property handling

GitBox
In reply to this post by GitBox

davsclaus edited a comment on issue #560:
URL: https://github.com/apache/camel-k-runtime/issues/560#issuecomment-732138986


   Yeah have you tried that extract property thingy? And if so then there should likely only need code changes in camel-kamelet component and not in core camel


----------------------------------------------------------------
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:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [camel-k-runtime] lburgazzoli commented on issue #560: camel-kamelet: rimprove global property handling

GitBox
In reply to this post by GitBox

lburgazzoli commented on issue #560:
URL: https://github.com/apache/camel-k-runtime/issues/560#issuecomment-732140534


   not yet


----------------------------------------------------------------
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:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [camel-k-runtime] davsclaus commented on issue #560: camel-kamelet: rimprove global property handling

GitBox
In reply to this post by GitBox

davsclaus commented on issue #560:
URL: https://github.com/apache/camel-k-runtime/issues/560#issuecomment-732145464


   Okay if you dont find the time and when I get the compiled simple done, then I can take a look


----------------------------------------------------------------
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:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [camel-k-runtime] lburgazzoli commented on issue #560: camel-kamelet: improve global properties handling

GitBox
In reply to this post by GitBox

lburgazzoli commented on issue #560:
URL: https://github.com/apache/camel-k-runtime/issues/560#issuecomment-732960311


   Ok, so after we get [CAMEL-15886](https://issues.apache.org/jira/browse/CAMEL-15886), [/CAMEL-15887](https://issues.apache.org/jira/browse/CAMEL-15887) solved and we get camel 3.7 out then we can get this working
   


----------------------------------------------------------------
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:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [camel-k-runtime] lburgazzoli edited a comment on issue #560: camel-kamelet: improve global properties handling

GitBox
In reply to this post by GitBox

lburgazzoli edited a comment on issue #560:
URL: https://github.com/apache/camel-k-runtime/issues/560#issuecomment-732960311


   Ok, so after we get [CAMEL-15886](https://issues.apache.org/jira/browse/CAMEL-15886), [CAMEL-15887](https://issues.apache.org/jira/browse/CAMEL-15887) solved and we get camel 3.7 out then we can get this working
   


----------------------------------------------------------------
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:
[hidden email]


Reply | Threaded
Open this post in threaded view
|

[GitHub] [camel-k-runtime] lburgazzoli edited a comment on issue #560: camel-kamelet: improve global properties handling

GitBox
In reply to this post by GitBox

lburgazzoli edited a comment on issue #560:
URL: https://github.com/apache/camel-k-runtime/issues/560#issuecomment-732960311


   Ok, so after we get [CAMEL-15886](https://issues.apache.org/jira/browse/CAMEL-15886), [CAMEL-15887](https://issues.apache.org/jira/browse/CAMEL-15887) solved and we get camel 3.7 out then we can get this working. At the moment we can use `camel.component.kamelet.configuration.template-properties[myTemplate].foo`
   


----------------------------------------------------------------
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:
[hidden email]