Return-Path: Delivered-To: apmail-activemq-camel-user-archive@locus.apache.org Received: (qmail 2237 invoked from network); 3 Jun 2008 00:28:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Jun 2008 00:28:08 -0000 Received: (qmail 81475 invoked by uid 500); 3 Jun 2008 00:28:11 -0000 Delivered-To: apmail-activemq-camel-user-archive@activemq.apache.org Received: (qmail 81454 invoked by uid 500); 3 Jun 2008 00:28:11 -0000 Mailing-List: contact camel-user-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: camel-user@activemq.apache.org Delivered-To: mailing list camel-user@activemq.apache.org Received: (qmail 81442 invoked by uid 99); 3 Jun 2008 00:28:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jun 2008 17:28:11 -0700 X-ASF-Spam-Status: No, hits=4.0 required=10.0 tests=DNS_FROM_OPENWHOIS,FORGED_YAHOO_RCVD,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Jun 2008 00:27:15 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1K3KNF-0000Jo-CY for camel-user@activemq.apache.org; Mon, 02 Jun 2008 17:27:37 -0700 Message-ID: <17613713.post@talk.nabble.com> Date: Mon, 2 Jun 2008 17:27:37 -0700 (PDT) From: bwtaylor To: camel-user@activemq.apache.org Subject: Re: Controlling the ApplicationContext used by a RouteBuilder In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: bryan_w_taylor@yahoo.com References: <17594236.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org I'd still need the activemq.xml to start my ApplicationContext, as I want it's lifecycle coupled to that of ActiveMQ and effectively embedded within ActiveMQ. I suppose I could do by simply putting a factory bean for it in activemq.xml. I liked the idea of my AC being the parent of the one created by ActiveMQ, so that you still could put xml routes in activemq.xml with the combined registry. I already tried it by subclassing XBeanBrokerFactory.createApplicationContext(String uri) to call my parent locator class followed by new ResourceXmlApplicationContext(resource, parent). This solves my problem but isn't generalizable because I have to import my specific locator. It's not particularly elegant, but it works. Interestingly, ResourceXmlApplicationContext does implement ConfigurableApplicationContext which gives the setParent() method, so there might be a way to combine our ideas. CamelContextFactoryBean could support setParentApplicationContext() injected from the activmq.xml Context and then it could use the combined (adopted?) AC if the child can be cast to ConfigurableApplicationContext and a parent exists. Actually, ConfigurableApplicationContext might be better a better interface to use generally, since your implementation already conforms to it, and it also allows you to add application listeners, to add both flavors of post processors, to refresh, and to add shutdown hooks. Application listeners and refresh both seem very valueable. If this interests you, let me know, as I'd be willing to send in patches. James.Strachan wrote: > > Why not put the elements into your other > spring XML file? (i.e. remove the package element from the activemq.xml) > -- View this message in context: http://www.nabble.com/Controlling-the-ApplicationContext-used-by-a-RouteBuilder-tp17594236s22882p17613713.html Sent from the Camel - Users mailing list archive at Nabble.com.