Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 29698 invoked from network); 29 Apr 2010 09:40:19 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 29 Apr 2010 09:40:19 -0000 Received: (qmail 4932 invoked by uid 500); 29 Apr 2010 09:40:18 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 4910 invoked by uid 500); 29 Apr 2010 09:40:18 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 4895 invoked by uid 99); 29 Apr 2010 09:40:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Apr 2010 09:40:17 +0000 X-ASF-Spam-Status: No, hits=-0.4 required=10.0 tests=AWL,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of willem.jiang@gmail.com designates 209.85.222.190 as permitted sender) Received: from [209.85.222.190] (HELO mail-pz0-f190.google.com) (209.85.222.190) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Apr 2010 09:40:11 +0000 Received: by pzk28 with SMTP id 28so2826531pzk.11 for ; Thu, 29 Apr 2010 02:39:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=PYCaVKkSDepP01/at0AuZ8jx+Jw3Zp2+LQP6P8f7z88=; b=mOMbk840EHQuoHaH4aXmwCU+5kn241Owp9Xz908WEZwbt1fetimEQPDxl6tKNDwjGZ 9qKpIDSNPBOfVa0eSXuyIBxDrd9rhlD1mR+ERxS30wdIpgerxW8oDQnLCh9EXQMyNK3D R+ZKLdwZuZFglNakwkQg00aAlCaz8XAr2Fdv4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=OeJbmdanBims6Alr2ppSWv2FEZ+1yIaXkKD4YXhD8wGZYxFLGo3T95mINK90APn47v KcSncceGnue0YBSqkZjSfEx4Yqzi+qZh2E0igVj31XAeiopxAyOvld9l4nnGRoSme8vY IsjEn18qwMqaJo/gCIg6UV18OqDR+S6YIuQn0= Received: by 10.115.115.39 with SMTP id s39mr6530925wam.119.1272533991093; Thu, 29 Apr 2010 02:39:51 -0700 (PDT) Received: from [192.168.0.158] ([125.33.127.123]) by mx.google.com with ESMTPS id f11sm3217931wai.11.2010.04.29.02.39.48 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 29 Apr 2010 02:39:50 -0700 (PDT) Message-ID: <4BD953E1.8050909@gmail.com> Date: Thu, 29 Apr 2010 17:39:45 +0800 From: Willem Jiang User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228) MIME-Version: 1.0 To: users@camel.apache.org Subject: Re: Camel startup dependencies in OSGI/Karaf References: <4BD84083.3010002@gmail.com> <4BD8EF54.5000504@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Bengt Rodehav wrote: > This is exactly the way I was thinking: > > - Define a new interface representing a Camel component ( e g > CamelComponentService) > - Use a service property to identify the specific componente (e g > "camel.component") > > This enables me to wait for a service with that specific service > property to be available. E g in my case I'm using iPOJO to > instantiate OSGI service and can use an annotation similar to the > following: > > @Requires(filter={camel.component=file}) > private CamelComponentService fileComponent; Yeah, it's much clear for me. But if your camel route have to deal with more than ten camel components, does it necessary to list all the dependencies with the iPOJO annotation? Willem > > I didn't check that I used the right syntax above. However, the result > is that my service will not be started until a CamelComponentService > with the service property "camel.component" with the value "file" has > been started. I think this would be very useful. It gives Camel a way > to publish the availability of components to the outside world - and > also a way to do it the OSGI way. > > /Bengt > > > 2010/4/29 Guillaume Nodet : >> We don't have to add anything to the component jars I think. It should be >> possible to extend camel-osgi bundle in the following way: >> * when a bundle containing a component is started, register a service in >> the osgi registry for the component. I think it should be a new interface >> which will allow the creation of components (a component factory) >> registered with an asssociated property to identify the type of component >> (file, jms, etc...) >> * modify the osgi component resolver or camel context go to the registry >> and wait for some time until all the components are available >> The last part might be a bit more tricky, as we need to find a good strategy >> for that. It could also be configurable on the osgi component context to >> some degree. >> >> On Thu, Apr 29, 2010 at 04:30, Willem Jiang wrote: >> >>> Bengt Rodehav wrote: >>> >>>> Thanks for your reply Willem, >>>> >>>> I will try to the bundle dependency of camel-core to my route bundle >>>> as you suggested - sounds like good advice. >>>> >>>> I wasn't sure what you mean by your last paragraph: >>>> >>>> If you need to dependent on some specify component interface will >>>>> introduce >>>>> the OSGi related dependency to the camel components. >>>>> We need to find another way to do it. >>>>> >>>> I assume that there was a problem with my suggestion but I didn't >>>> quite understand what. >>>> >>> Oh, that is if you want to publish the camel components into a OSGi >>> service, you can do it in the BundleActivator, or write some XML >>> configuration to leverage Spring DM or Blue Print to do it. >>> >>> If you are using BundleActivator, you will introduce some kind of compile >>> time dependency of OSGi jar. As we also want camel components work well as a >>> stand alone Java application, we should avoid introduce this kind of >>> dependency. >>> >>> Maybe the xml configuration is a choice for us. >>> >>> This solution need to your start the Spring-DM or BluePrint container >>> before your camel route bundle to let the container lookup the bundle >>> context for the xml configuration. It seems we are back to your original >>> question. And if you start the camel components bundles before you start up >>> your camel route bundle, you will not hit this kind of issue. >>> >>> Willem >>> >>> >>> >>>> /Bengt >>>> >>>> >>>> >>>> 2010/4/28 Willem Jiang : >>>> >>>>> Hi >>>>> >>>>> Please see my comments in the mail. >>>>> >>>>> Bengt Rodehav wrote: >>>>> >>>>>> I'm using Karaf to deploy my Camel routes. However, I run into >>>>>> problems during startup due to dependency ordering. Some of these >>>>>> ordering problems are OSGI/Karaf specific and have nothing to do with >>>>>> Camel. I've discussed them on the Felix user mailing list and I have >>>>>> workarounds for that. The Camel problems remain though. >>>>>> >>>>>> When trying to deploy both my routes and the camel bundles in Karaf, >>>>>> my routes fail to iniitialize because the referenced camel component >>>>>> ("file:" in this case) is not registered in Camel yet. I've tried to >>>>>> solve this with workarounds in Karaf. It is possible but not very >>>>>> elegant at all. >>>>>> >>>>> Can you add the bundle dependency of camel-core to your route bundle? >>>>> >>>>>> Guillaume Nodet (via users@felix.apache.org) suggested to me that this >>>>>> is more of a Camel problem than a Karaf problem. In his opinion (and >>>>>> mine), it would be much better if Camel published components using >>>>>> OSGI services. That way my services could have a service dependency on >>>>>> the Camel services so that my service would start when the Camel >>>>>> service was available. As I understand it, today Camel just scans >>>>>> bundles as they are started and updates its component registry. This >>>>>> makes it impossible for dependent bundles (like my routes) to know >>>>>> whether all the required prerequisites are in place before starting >>>>>> the route. >>>>>> >>>>> That could be a solution of your issue. >>>>> >>>>>> If components were published using a component specific interface, I >>>>>> could add a service dependency to that service and wait until it >>>>>> becomes available before trying to start my routes. >>>>>> >>>>>> If you need to dependent on some specify component interface will >>>>> introduce >>>>> the OSGi related dependency to the camel components. >>>>> We need to find another way to do it. >>>>> >>>>> Has anyone else had similar issues?What is the recommended workaround? >>>>>> Are there any plans for improvement? >>>>>> >>>>>> /Bengt >>>>>> >>>>>> >>>>> Willem >>>>> >>>>> >> >> -- >> Cheers, >> Guillaume Nodet >> ------------------------ >> Blog: http://gnodet.blogspot.com/ >> ------------------------ >> Open Source SOA >> http://fusesource.com >> >