[jira] [Comment Edited] (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&focusedCommentId=15684140#comment-15684140 ] Sverker Abrahamsson edited comment on CAMEL-10391 at 11/21/16 5:28 PM: --- Any suggestion on how to start on a configuration API? How about injecting an optional properties class in CdiCamelExtension? {noformat} @Inject @CdiCamelProperties private Optional cdiCamelProperties; {noformat} With for this purpose a property autoStartRoutes. Or a variant which implements an interface with usable properties: {noformat} @Inject private Optional<@CdiCamelProperties> cdiCamelProperties; {noformat} was (Author: sverker): 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] [Comment Edited] (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&focusedCommentId=15684074#comment-15684074 ] Sverker Abrahamsson edited comment on CAMEL-10391 at 11/21/16 5:03 PM: --- 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.. I know it breaks compatibility but that's how it should have been from beginning .. Any suggestion on how to implement a configuration bean as discussed above? was (Author: sverker): 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] [Comment Edited] (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&focusedCommentId=15588212#comment-15588212 ] Antonin Stefanutti edited comment on CAMEL-10391 at 10/19/16 9:44 AM: -- {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 instances 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. was (Author: antonin.stefanutti): {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] [Comment Edited] (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&focusedCommentId=15588192#comment-15588192 ] Sverker Abrahamsson edited comment on CAMEL-10391 at 10/19/16 9:40 AM: --- 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. {quote}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.{quote} Yes, that is what I feel is a design problem in many of these frameworks that it doesn't take dynamicality into account. The programmatic lookup wasn't added until CDI 1.1 if I recall correctly. was (Author: sverker): 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. {quote} {quote} > 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] [Comment Edited] (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&focusedCommentId=15588192#comment-15588192 ] Sverker Abrahamsson edited comment on CAMEL-10391 at 10/19/16 9:39 AM: --- 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. {quote} {quote} was (Author: sverker): 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] [Comment Edited] (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&focusedCommentId=15588192#comment-15588192 ] Sverker Abrahamsson edited comment on CAMEL-10391 at 10/19/16 9:36 AM: --- 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. was (Author: sverker): 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] [Comment Edited] (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&focusedCommentId=15586084#comment-15586084 ] Sverker Abrahamsson edited comment on CAMEL-10391 at 10/18/16 5:35 PM: --- 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 are set up with parameters retrieved from db. was (Author: sverker): 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)