Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A01EC200BCB for ; Wed, 19 Oct 2016 11:18:00 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 9EC38160ADE; Wed, 19 Oct 2016 09:18:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E8D30160AFB for ; Wed, 19 Oct 2016 11:17:59 +0200 (CEST) Received: (qmail 49866 invoked by uid 500); 19 Oct 2016 09:17:59 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 49737 invoked by uid 99); 19 Oct 2016 09:17:58 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Oct 2016 09:17:58 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id BA3492C4C7C for ; Wed, 19 Oct 2016 09:17:58 +0000 (UTC) Date: Wed, 19 Oct 2016 09:17:58 +0000 (UTC) From: "Antonin Stefanutti (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CAMEL-10391) Camel-CDI adds every RouteBuilder instance it can find to Camel context MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 19 Oct 2016 09:18:00 -0000 [ https://issues.apache.org/jira/browse/CAMEL-10391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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)