You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/05/07 16:15:57 UTC
[GitHub] [camel] lburgazzoli opened a new pull request #5530: CAMEL-16570: make it possible to discover kamelets at runtime
lburgazzoli opened a new pull request #5530:
URL: https://github.com/apache/camel/pull/5530
<!-- Uncomment and fill this section if your PR is not trivial
- [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.
- [ ] Each commit in the pull request should have a meaningful subject line and body.
- [ ] If you're unsure, you can format the pull request title like `[CAMEL-XXX] Fixes bug in camel-file component`, where you replace `CAMEL-XXX` with the appropriate JIRA issue.
- [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [ ] Run `mvn clean install -Psourcecheck` in your module with source check enabled to make sure basic checks pass and there are no checkstyle violations. A more thorough check will be performed on your pull request automatically.
Below are the contribution guidelines:
https://github.com/apache/camel/blob/main/CONTRIBUTING.md
-->
--
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:
users@infra.apache.org
[GitHub] [camel] davsclaus commented on a change in pull request #5530: CAMEL-16570: make it possible to discover kamelets at runtime
Posted by GitBox <gi...@apache.org>.
davsclaus commented on a change in pull request #5530:
URL: https://github.com/apache/camel/pull/5530#discussion_r630107165
##########
File path: components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletComponent.java
##########
@@ -348,19 +362,36 @@ public LifecycleHandler() {
this.initialized = new AtomicBoolean();
}
- public static void createRouteForEndpoint(KameletEndpoint endpoint) throws Exception {
- LOGGER.debug("Creating route from template={} and id={}", endpoint.getTemplateId(), endpoint.getRouteId());
+ public void createRouteForEndpoint(KameletEndpoint endpoint) throws Exception {
+ final ExtendedCamelContext ecc = getCamelContext().adapt(ExtendedCamelContext.class);
+ final ModelCamelContext context = getCamelContext().adapt(ModelCamelContext.class);
+ final String templateId = endpoint.getTemplateId();
+ final String routeId = endpoint.getRouteId();
+
+ if (context.getRouteTemplateDefinition(templateId) == null) {
+ LOGGER.debug("Loading route template={} from {}", templateId, getLocation());
+
+ String path = getLocation();
+ if (path != null) {
+ if (!path.endsWith("/")) {
+ path += "/";
+ }
+
+ ecc.getRoutesLoader().loadRoutes(
+ ecc.getResourceLoader().resolveResource(path + templateId + ".kamelet.yaml"));
Review comment:
I think we may need a blurb in the documentation (somewhere) about the convention to use templateId.kamelet.yaml as the default file pattern for loading kamelets.
##########
File path: components/camel-kamelet/src/main/java/org/apache/camel/component/kamelet/KameletComponent.java
##########
@@ -73,6 +74,8 @@
private Map<String, Properties> templateProperties;
@Metadata
private Map<String, Properties> routeProperties;
+ @Metadata(defaultValue = "classpath:/kamelets")
Review comment:
Maybe this should use the DEFAULT_LOCATION constant
--
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:
users@infra.apache.org
[GitHub] [camel] lburgazzoli commented on pull request #5530: CAMEL-16570: make it possible to discover kamelets at runtime
Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on pull request #5530:
URL: https://github.com/apache/camel/pull/5530#issuecomment-838287074
The default location of the kamelet is configured using the `location` property on the component: https://github.com/apache/camel/pull/5530/files#diff-c8ca673dbc2946a5cc99b0af04e10fbe0f72b4a7edd522e6454e281241fb998fR269-R279
The name is very bad I think but don't know what a better name could be, any suggestion ?
--
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:
users@infra.apache.org
[GitHub] [camel] lburgazzoli merged pull request #5530: CAMEL-16570: make it possible to discover kamelets at runtime
Posted by GitBox <gi...@apache.org>.
lburgazzoli merged pull request #5530:
URL: https://github.com/apache/camel/pull/5530
--
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:
users@infra.apache.org
[GitHub] [camel] lburgazzoli edited a comment on pull request #5530: CAMEL-16570: make it possible to discover kamelets at runtime
Posted by GitBox <gi...@apache.org>.
lburgazzoli edited a comment on pull request #5530:
URL: https://github.com/apache/camel/pull/5530#issuecomment-838287074
The default location of the kamelet is configured using the `location` property on the component: https://github.com/apache/camel/pull/5530/files#diff-c8ca673dbc2946a5cc99b0af04e10fbe0f72b4a7edd522e6454e281241fb998fR269-R279
The name is very bad I think but don't know what a better name could be (i.e. `kamelet-location` does not look very nice when used in congiunction with the properties based config `camel.component.kamelet.kamelet-location`), any suggestion ?
--
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:
users@infra.apache.org
[GitHub] [camel] lburgazzoli commented on pull request #5530: CAMEL-16570: make it possible to discover kamelets at runtime
Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on pull request #5530:
URL: https://github.com/apache/camel/pull/5530#issuecomment-834589470
@davsclaus
this is a draft PR to show some work I'm doing in the context of making possible to discover kamelets at runtime [CAMEL-16570](https://issues.apache.org/jira/browse/CAMEL-16570). It is not complete but I'd like to have some early feedback on this as I have introduced a new extension that can be handled by the routes loader: `.kamelet.yaml` and I'm unsure if that's the right thing to do.
I could create a similar logic in the camel-kamelet component but then the component would depends on the yaml dsl.
--
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:
users@infra.apache.org