Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 71691 invoked from network); 17 Feb 2011 06:08:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Feb 2011 06:08:13 -0000 Received: (qmail 44391 invoked by uid 500); 17 Feb 2011 06:08:13 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 44133 invoked by uid 500); 17 Feb 2011 06:08:10 -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 44125 invoked by uid 99); 17 Feb 2011 06:08:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Feb 2011 06:08:10 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [62.75.158.78] (HELO mail.liquid-reality.de) (62.75.158.78) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Feb 2011 06:08:03 +0000 Received: from [10.0.0.102] (HSI-KBW-091-089-013-105.hsi2.kabelbw.de [91.89.13.105]) by mail.liquid-reality.de (Postfix) with ESMTP id 06603B38002 for ; Thu, 17 Feb 2011 06:07:42 +0000 (UTC) Message-ID: <4D5CBB14.7080201@die-schneider.net> Date: Thu, 17 Feb 2011 07:07:16 +0100 From: Christian Schneider User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.13) Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7 MIME-Version: 1.0 To: users@camel.apache.org Subject: Re: Camel Osgi Component References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi Roshan, I may have a solution may have a solution to your problem. Yesterday I had a chat with Achim Nierbeck from Karaf and Pax Web. We talked about integration on OSGi and if the NMR is needed or not. So while using the NMR is one option for you Achim also told me he had succesfully used the seda component to talk between bundles. He simply published the seda component with interface Component as an OSGi service. Then he added a service reference to the other bundles. In spring having a bean with id seda means for camel that there is a component seda. Without spring you can simply add the component by hand. So this could be an easy solution. It is quite elegant as it only needs to register / reference the component once and then it can be used like normal. Christian Am 15.02.2011 17:16, schrieb Roshan A. Punnoose: > Hi, > > I am looking for an osgi camel component that acts sort of like a "direct/seda" endpoint between bundles. > > For example, > > Bundle A: > from("something").to("osgidirect:endpoint") > > Bundle B: > from("osgidirect:endpoint")... > > Bundle C: > from("osgidirect:endpoint")... > > I have been able to develop something like this and it is working in the OSGi container, but I was wondering if there is something already available out there like this. > > If not, I can explain how I did this, and get your advice on how to proceed. > > So the component works by registering and consuming osgi services. The Consumer gets registered as an OSGi service with property (endpointName="endpoint"), the Producer pulls all services with an OSGi filter of (endpointName="endpoint"). And all this seems to work. > > My only issue is how I access the BundleContext. To be able to register and consume services, I need access to the BundleContext of the bundles that are consuming/producing (Bundle A/B/C). The way I have gotten around this right now, is to make sure that I always define the Consumer as a Spring Bean, and implement BundleContextAware, so that Spring DM will inject the BundleContext. However, I don't want to impose this restriction. Looking through the source code, I noticed that the OsgiCamelContext (or OsgiSpringCamelContext) holds the bundleContext as a private variable. Is there anyway we could expose that bundleContext somewhere on the context so that when I create the Consumer/Producer I can pull this from the CamelContext in some way? (Or is it exposed someway already that I haven't seen?) > > Thanks so much! > > Roshan -- ---- http://www.liquid-reality.de