[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15728470#comment-15728470 ] Sverker Abrahamsson commented on CAMEL-10391: - Excellent > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > Fix For: 2.19.0 > > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15728461#comment-15728461 ] Antonin Stefanutti commented on CAMEL-10391: I've just updated the documentation and the 2.19 release note. > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > Fix For: 2.19.0 > > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15715677#comment-15715677 ] Claus Ibsen commented on CAMEL-10391: - Please update the release notes with this new feature/change http://camel.apache.org/camel-219-release.html > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > Fix For: 2.19.0 > > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15715631#comment-15715631 ] ASF GitHub Bot commented on CAMEL-10391: Github user asfgit closed the pull request at: https://github.com/apache/camel/pull/1319 > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > Fix For: 2.19.0 > > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15706275#comment-15706275 ] ASF GitHub Bot commented on CAMEL-10391: Github user sverkera closed the pull request at: https://github.com/apache/camel/pull/1320 > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15706212#comment-15706212 ] ASF GitHub Bot commented on CAMEL-10391: GitHub user sverkera opened a pull request: https://github.com/apache/camel/pull/1320 Created a mechanism to configure Camel CDI via CDI event. See https://issues.apache.org/jira/browse/CAMEL-10391 for details, patch for 2.18.x branch You can merge this pull request into a Git repository by running: $ git pull https://github.com/sverkera/camel camel-2.18.x Alternatively you can review and apply these changes as the patch at: https://github.com/apache/camel/pull/1320.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1320 commit 17ad17af8cc91fd3c319ad109ead8a5962cc4b9f Author: Sverker AbrahamssonDate: 2016-11-29T18:51:31Z Created a mechanism to configure Camel CDI via CDI event. Currently the only setting is to turn off automatic add of RouteBuilders to context. > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15706207#comment-15706207 ] ASF GitHub Bot commented on CAMEL-10391: GitHub user sverkera opened a pull request: https://github.com/apache/camel/pull/1319 Created a mechanism to configure Camel CDI via CDI event. See https://issues.apache.org/jira/browse/CAMEL-10391 for details You can merge this pull request into a Git repository by running: $ git pull https://github.com/sverkera/camel master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/camel/pull/1319.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1319 commit 71d7939c419a98de5a3edc5aa8050f04eeb0 Author: Sverker AbrahamssonDate: 2016-11-29T18:51:31Z Created a mechanism to configure Camel CDI via CDI event. Currently the only setting is to turn off automatic add of RouteBuilders to context. > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15705423#comment-15705423 ] Sverker Abrahamsson commented on CAMEL-10391: - Ok, found the issue. I was sending the configuration event in method listening to AfterDeploymentValidation, but that is called after AfterBeanDiscovery which is where CdiCamelExtension hangs when trying to add my RouteBuilders. So I moved the code for sending out the event to first thing in CdiCamelExtension.afterBeanDiscovery() and it works like a charm. > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15704687#comment-15704687 ] Antonin Stefanutti commented on CAMEL-10391: I would try to ask the CDI dev list first about the best strategy as CDI and EAR is a bit ill-defined. > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15704667#comment-15704667 ] Sverker Abrahamsson commented on CAMEL-10391: - Seems to be the issue with CDI events over classloader boundary which is an issue with ear packaged apps. Any idea on how to work around that? > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15691442#comment-15691442 ] Sverker Abrahamsson commented on CAMEL-10391: - I've made an implementation as in your example, and it works in a testcase which is packaged as a war. But when the class containing observer is packaged in an ejb jar in an ear, then the observer is not called. It is declared like this: {noformat} public class CdiCamelConfiguration { private Logger logger = LoggerFactory.getLogger(CdiCamelConfiguration.class); public void configuration(@Observes org.apache.camel.cdi.CdiCamelConfiguration configuration) { logger.info("Turning off Camel CDI autostart of routes"); configuration.autostartRoutes(false); } } {noformat} > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15684312#comment-15684312 ] Sverker Abrahamsson commented on CAMEL-10391: - Yes, the event variant would be beautiful. Didn't think of that it would be possible to change parameters in the event object. > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15684290#comment-15684290 ] Antonin Stefanutti commented on CAMEL-10391: {quote} How do you do optional injects in other way than using Optional? {quote} it is possible to do optional programmatic lookup with {{Instance}} or the {{BeanManager}}. {quote} CdiCamelExtension isn't serializable neither so that part shouldn't be a problem. Top pom in camel still defines jdk version to 1.7. {quote} See: https://github.com/apache/camel/blob/da8694f8c5392881ac5ab49c37a7947451bb65af/pom.xml#L49 {quote} How would the event variant work? {quote} I'm thinking about what is done in the Metrics CDI extension: https://github.com/astefanutti/metrics-cdi/blob/abac97f7d903651884de92421ce53bf7d0499d08/impl/src/main/java/io/astefanutti/metrics/cdi/MetricsConfigurationEvent.java#L23 > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15684276#comment-15684276 ] Sverker Abrahamsson commented on CAMEL-10391: - How do you do optional injects in other way than using Optional? CdiCamelExtension isn't serializable neither so that part shouldn't be a problem. Top pom in camel still defines jdk version to 1.7. Agreed that an interface is better for type safety. How would the event variant work? > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15684247#comment-15684247 ] Antonin Stefanutti commented on CAMEL-10391: Camel CDI compiles on Java 8 since Camel 2.18.0 so that would be fine. Though having {{Optional}} members in always debatable as it is not serialisable. Indeed it has been designed to be used more as return type than to carry state. See [Optional Injection Points|https://issues.jboss.org/browse/CDI-45] for some elements on this. For the configuration API, I was thinking about an interface that the user could implement that's more type safe than a {{Properties}} bean. The extension can easily deal with optionality. Or an event fired by the extension providing a event object that the user could use to pass some configuration. the later would be more CDI-ish IMO. > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15684199#comment-15684199 ] Sverker Abrahamsson commented on CAMEL-10391: - I see now that Optional came in Java 8, and camel-cdi is compiled with source level 1.7 .. > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15684140#comment-15684140 ] Sverker Abrahamsson commented on CAMEL-10391: - Any suggestion on how to start on a configuration API? > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15684131#comment-15684131 ] Antonin Stefanutti commented on CAMEL-10391: {quote} Looking at this again. Isn't the obvious solution that only RouteBuilders annotated with @Startup should be automatically added to the context? Although that is an EJB annotation.. {quote} I doubt adding an explicit dependency on the EJB specification would be wise. {quote} I know it breaks compatibility but that's how it should have been from beginning .. {quote} It has to be kept in mind that 95% of user feedback we've got is that they want to have their Camel context started with the container. Hence the convention to start the Camel CDI contexts for these vast majority of users. Still a proper configuration API has to be provided for the remaining users. > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15684074#comment-15684074 ] Sverker Abrahamsson commented on CAMEL-10391: - Looking at this again. Isn't the obvious solution that only RouteBuilders annotated with @Startup should be automatically added to the context? I know it breaks compatibility but that's how it should have been from beginning .. > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15588231#comment-15588231 ] Sverker Abrahamsson commented on CAMEL-10391: - Fully agree on the latter. > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15588212#comment-15588212 ] Antonin Stefanutti commented on CAMEL-10391: {quote}If I use @Veto, can I then use injection in the RouteBuilder bean and get it injected when emphasis_I_emphasis want.{quote} Injection will work when calling {{new Unmanaged(MyRouteBuilder.class).newInstance().produce().inject().get()}}. {{Unmanaged}} is a way to dynamically produce instance out of classes that are not beans, and the {{inject()}} method call triggers the injection. {quote}A config API would be the best solution in my opinion, e.g. with an annotated config bean.{quote} This is my opinion too so we can try iterate in that direction. We may want to have it consistent as much as possible with what exists for other DI frameworks that Camel supports. > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15588192#comment-15588192 ] Sverker Abrahamsson commented on CAMEL-10391: - If I use @Veto, can I then use injection in the RouteBuilder bean and get it injected when _emphasis_I_emphasis_ want. A config API would be the best solution in my opinion, e.g. with an annotated config bean. I'm not sure when this behavior was introduced. It didn't work like that when I started to use camel-cdi (2.15 I believe) and when I moved to 2.16 I started to use your new implementation where this was implemented sometime before I wrote issue 12. > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15588147#comment-15588147 ] Antonin Stefanutti commented on CAMEL-10391: Another way of meeting that need may be the use of standard {{@Veto}} and {{Unmanaged}}, e.g.: {code} @Veto MyRouteBuilder extends RouteBuilder { } MyRouteBuilder builder = new Unmanaged(MyRouteBuilder.class) .newInstance() .produce() .inject() .postConstruct() .get(); {code} Granted that it is more verbose than a configuration. > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15588123#comment-15588123 ] Antonin Stefanutti commented on CAMEL-10391: {quote}Given that RouteBuilders that are automatically added to context will be on application level the _emphasis_standard_emphasis_ CDI behavior is that they should be @ApplicationScoped. It is defenitly not a CDI behavior to make other beans de-facto application scoped.{quote} _standard_ CDI behaviour for beans discovery is defined by [Type discovery|http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#type_discovery_steps] and [Beans discovery|http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#bean_discovery_steps]. If Camel CDI is to fit into that _standard_ CDI behaviour, {{RouteBuilder}} beans without explicit scope defined (i.e. {{@Dependent}}) should be deployed as beans. That answers the previous point discussed. Then, for the binding of {{RouteBuilder}} beans to the Camel contexts, Camel CDI does not _"make other beans de-facto application scoped"_. It just assumes the scope defined by the user. Note that it is possible to inject {{@Dependent}} beans into {{@ApplicationScoped}} beans and that if was necessary to enforce a particular scope for {{RouteBuilder}} beans, maybe a {{@CamelContextScoped}} would be better as some users have expressed the need to share a {{RouteBuilder}} beans across multiple Camel contexts. {quote}Regarding the backwards compatibility, it broke that for my applications when this behavior was introduced in 2.17 and I was surprised as I didn't expect it. That is a quite recent version and shouldn't be too much of a hazzle for those affected to add the annotation.{quote} That behaviour, that is adding {{RouteBuilder}} beans with implicit scope to Camel contexts, wasn't changed in 2.17, as the following test from 2.16.4 shows: https://github.com/apache/camel/blob/camel-2.16.4/tests/camel-itest-cdi/src/main/java/org/apache/camel/itest/cdi/RoutesContextA.java#L35. So there must be something else that broke your use case. {quote}With that said, I'm all for convension IF there is a possibility to override it by configuration in a reasonable way. Don't get me wrong, I think that if used correctly it's beautiful to be able to automatically add routes to context by using qualifers. What I'm against is that non-qualified, and not application scoped RouteBuilders are automatically added to default context and that it is autostarted. I was fine with having to bootstrap it, as at least before there were certain things that had to be done before the context was started but it seems that now it is possible to do it also after.{quote} I'm aware of two users so far having that need. As per your comment after, CDI is designed with immutability in mind, that is the container configuration is setup at deployment time (not compile time as extensions can change the behaviour). While you have the ability to do programmatic lookup, that's pretty much it when it comes to dynamically interacting with the container at runtime. To synthesize, it is possible to meet your need with the use of a custom qualifier. However, that forces you to use that qualifier when you need to retrieve instances. e.g.: {code} @Inject @YourCustomQualifier RouteBuilder builder; {code} Instead of: {code} @Inject RouteBuilder builder; {code} Or to write {{CDI.current().select(RouteBuilder.class, YourCustomQualifier.class).get()}} instead of {{CDI.current().select(RouteBuilder.class).get()}}. I agree this is cumbersome and I more incline towards providing a configuration API as Camel Spring Boot does rather than hindering the default convention based on scope assumptions. Note that for the time being, that use case is not even possible with Spring Boot (https://github.com/apache/camel/blob/e275446a4768231a76c76e24985b796865550e3b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java#L78). > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with >
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15587412#comment-15587412 ] Sverker Abrahamsson commented on CAMEL-10391: - Given that RouteBuilders that are automatically added to context will be on application level the _emphasis_standard_emphasis_ CDI behavior is that they should be @ApplicationScoped. It is defenitly not a CDI behavior to make other beans de-facto application scoped. Regarding the backwards compatibility, it broke that for my applications when this behavior was introduced in 2.17 and I was surprised as I didn't expect it. That is a quite recent version and shouldn't be too much of a hazzle for those affected to add the annotation. With that said, I'm all for convension IF there is a possibility to override it by configuration in a reasonable way. Don't get me wrong, I think that if used correctly it's beautiful to be able to automatically add routes to context by using qualifers. What I'm against is that non-qualified, and not application scoped RouteBuilders are automatically added to default context and that it is autostarted. I was fine with having to bootstrap it, as at least before there were certain things that had to be done before the context was started but it seems that now it is possible to do it also after. With the EJB standards I often face the difficulty that they are designed with the belief that you know the application settings at compile time, or at least at packaging or deploy time while in real world applications it depends on what the user/admin sets up in the application through some user friendly interface (which is not having to edit xml files) and it is excepted that the application will change its behavior when user commits those settings without having to restart the application. For example, I have an application which consumes files from watchfolders that the user configures through a webui. Those settings are stored in the db, and I need to create RouteBuilders and other resources dynamically as I don't have that information even at deploy time. Likewise most of my JMS queues needs to be created dynamically, which I earlier did by calling the MBean but now I have to look at how to do that programatically through the CLI, and I can't utilize MDB's to consume from those queues so I have to dynamically instantiate beans or camel routes to consume from them. I wish that aspect had been considered when these standards were created. > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15586084#comment-15586084 ] Sverker Abrahamsson commented on CAMEL-10391: - I still want my RouteBuilders to be CDI beans as I instantiate them programatically with CDI.current().select( ... ).get(), or inject them into other beans. I just don't want them to automatically be added to the context and started, as I can have multiple instances of a route which receives parameters from db. > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15584867#comment-15584867 ] Antonin Stefanutti commented on CAMEL-10391: Yes {{DoNotAddToCamelContext}} can actually be anything, so a dummy name has been picked up just for the sake of the example. We may emulate Spring behaviour, that is to explicitly define which classes are to be considered CDI beans, though this may surprise most CDI users accustomed to the _standard_ behaviour. Plus, if I understand correctly, the use case here is not to exclude some {{RouteBuilder}} classes from being deployed as CDI beans, but avoid the auto-configuration that adds these {{RouteBuilder}} beans to the corresponding Camel context. Otherwise using the standard {{@Veto}} annotation would probably do the trick. > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15584833#comment-15584833 ] Sverker Abrahamsson commented on CAMEL-10391: - Claus, that is a good suggestion which I fully agree with and it fit how CDI should work. It has my vote for solution. (And yes, DoNotAddToCamelContext was a ugly hack to workaround the issue) > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15584779#comment-15584779 ] Claus Ibsen commented on CAMEL-10391: - IMHO an annotation named DoNotAddToCamelContext is a smelly name. I would actually like how Spring Boot does it where you need to annotate your RouteBuilder with @Component for them the be added. Why can we not make CDI require using @ApplicationScoped or @Singleton likewise. Then there is no voodoo magic. > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15583287#comment-15583287 ] Sverker Abrahamsson commented on CAMEL-10391: - The problem with having to add a qualifier to prevent autostart of the route is that I then have to add that qualifier to every place I want to inject that RouteBuilder. That is why I would like to be able to turn off that behavior with e.g. a configuration annotation. > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Improvement > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson >Assignee: Antonin Stefanutti > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15583236#comment-15583236 ] Antonin Stefanutti commented on CAMEL-10391: Just a small clarification about the current behaviour of Camel CDI: it does not add {{RouteBuilder}} beans that are qualified with a set of qualifiers that does not intersect with those of the declared {{CamelContext}} beans. So the use of a {{@DoNotAddToCamelContext}} does not require to patch Camel CDI and is an example to meet the requirement at the client application level. That being said, the current solution requires the end-user to declare a custom qualifier. This is does not hinder most of the users that rely on the default convention over configuration, though that may be deemed a bit cumbersome as configuration. We can review the needs for configuration over convention and find the best solution to achieve these in a common approach as you've suggested. > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Bug > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context
[ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15583235#comment-15583235 ] Antonin Stefanutti commented on CAMEL-10391: Just a small clarification about the current behaviour of Camel CDI: it does not add {{RouteBuilder}} beans that are qualified with a set of qualifiers that does not intersect with those of the declared {{CamelContext}} beans. So the use of a {{@DoNotAddToCamelContext}} does not require to patch Camel CDI and is an example to meet the requirement at the client application level. That being said, the current solution requires the end-user to declare a custom qualifier. This is does not hinder most of the users that rely on the default convention over configuration, though that may be deemed a bit cumbersome as configuration. We can review the needs for configuration over convention and find the best solution to achieve these in a common approach as you've suggested. > Camel-CDI adds every RouteBuilder instance it can find to Camel context > --- > > Key: CAMEL-10391 > URL: https://issues.apache.org/jira/browse/CAMEL-10391 > Project: Camel > Issue Type: Bug > Components: camel-cdi >Affects Versions: 2.18.0 > Environment: Wildfly 10 with wildfly-camel extension >Reporter: Sverker Abrahamsson > > Camel-CDI will find every class in a deployment which extends RouteBuilder > and automatically add them to the context. This is a major issue for me as I > usually wants to instantiate my RouteBuilders programatically setting various > parameters, with CDI support. > This behaviour was introduced with > https://github.com/apache/camel/commit/0421c24dfcf992f3296ed746469771e3800200e3 > from [~antonin.stefanutti] and we had a good discussion about the issue on > his github project in https://github.com/astefanutti/camel-cdi/issues/12 but > never came up with a good solution for it. I have patched camel-cdi to use a > marker annotation @DoNotAddToCamelContext to work around it but I don't want > to have to patch every release I use.. > I understand the logic why Camel-CDI finds and add every RouteBuilder class, > even though I don't agree that it is a good idea but it could very well be > the default behavior as long as it is possible to override it. > What I would like is a discussion on how this could be made configurable. I'm > thinking about if there could be an annotation like > @CamelContextStartup(false) or maybe even a more general > @CamelContextConfig(autostart=false) if there are other things that should be > configurable. -- This message was sent by Atlassian JIRA (v6.3.4#6332)