On Wed, Mar 9, 2011 at 8:43 AM, janne postilista
<[email protected]> wrote:
> Just to make sure I understand this correctly - installing the feature
> with the console should be enough?
>
> Let's say my OSGi bundle would use some exotic camel component, for
> example "kestrel". I would just do features:install camel-kestrel and
> configure my route definition to have for example <to
> uri="kestrel://ks02:22133/stuff"/>
>

Yes install the features first.

If you are using Camel with OSGi blueprint, then that is smarter and
is capable of "waiting" for the feature to be installed and ready.
However as a rule of thumb its much safer to install the needed
features beforehand.


> I would not need to modify my own OSGi bundle's Import-Package
> settings? Or add the "feature" as a maven dependency for my OSGi
> bundle project?
>

Usually not. Only if you bundle for some reason need access to any of
the classes from the given camel-xxx component.
Usually you don't.


>
>> If you happen to come across a component that's not installed, you
>> should be able to install it from the console by typing
>> 'features:install camel-<component>" to start using it.
>>
>> Regards,
>>
>> Gert Vanthienen
>> ------------------------
>> FuseSource
>> Web: http://fusesource.com
>> Blog: http://gertvanthienen.blogspot.com/
>>
>>
>>
>> On Tue, Mar 8, 2011 at 8:01 PM, janne postilista
>> <[email protected]> wrote:
>>> I see.
>>>
>>> Great, I got the dummy example working on FuseESB 4.3
>>>
>>> 1) added camel-activemq to example's feature
>>> (apache-servicemix-4.3.1-fuse-00-00-features.xml)
>>>
>>>    <feature name="examples-camel-osgi" version="4.3.1-fuse-00-00">
>>>        <feature>camel-activemq</feature>
>>>        <feature version="2.6.0-fuse-00-00">camel</feature>
>>>        
>>> <bundle>mvn:org.apache.servicemix.examples/camel-osgi/4.3.1-fuse-00-00</bundle>
>>>    </feature>
>>>
>>> 2) did not touch pom.xml maven-bundle-plugin confifuguration at all
>>>
>>> 3) configured a few routes:
>>>
>>>  <route>
>>>   <from uri="file:c:/projects/esb-files/jms-start" />
>>>   <setBody>
>>>    <simple>
>>>      Moving File to queue(file: ${file:name}, timestamp:
>>> ${date:now:hh:MM:ss.SSS})
>>>      ${in.body}
>>>    </simple>
>>>   </setBody>
>>>   <to uri="activemq://events" />
>>>  </route>
>>>
>>>  <route>
>>>   <from uri="activemq://events" />
>>>   <setBody>
>>>    <simple>
>>>     Receiving file from queue:[${in.body}]
>>>    </simple>
>>>   </setBody>
>>>   <to uri="file:c:/projects/esb-files/jms-end" />
>>>  </route>
>>>
>>> Transformed messages are popping in the target directory as expected.
>>>
>>> Still a bit confused about what was the problem with ServiceMix 4.2,
>>> what I should have done differently - should I have e.g. configured
>>> maven-bundle-plugin differently - and are there perhaps some camel
>>> components that are not yet "preinstalled" in ServiceMix 4.3 that I
>>> may need to fight with at later point, if need to use them presents
>>> itself...
>>>
>>> I any case, a good start, thanks for assisting!
>>>
>>> On Tue, Mar 8, 2011 at 8:03 PM, Gert Vanthienen
>>> <[email protected]> wrote:
>>>> Janne,
>>>>
>>>> No, this should work out-of-the-box -- you can still configure the
>>>> ActiveMQ component yourself if you want more control over how things
>>>> are set up, but there are some default settings for the activemq:
>>>> endpoints that make it possible to just deploy those routes as they're
>>>> printed out in the quickstart guide.
>>>>
>>>> Regards,
>>>>
>>>> Gert Vanthienen
>>>> ------------------------
>>>> FuseSource
>>>> Web: http://fusesource.com
>>>> Blog: http://gertvanthienen.blogspot.com/
>>>>
>>>>
>>>>
>>>> On Tue, Mar 8, 2011 at 6:55 PM, janne postilista
>>>> <[email protected]> wrote:
>>>>> Thanks for the quickstart pointer! Very helpful. I have been using
>>>>> different versions, ServiceMix 4.2 and 4.3, and Fuse ESB, so much that
>>>>> it seems I'm starting to lose track myself....the ClassCastException
>>>>> is from ServiceMix 4.2.
>>>>>
>>>>> I will try to follow the quickstart on SM 4.3 and get back to the
>>>>> issue after it. I guess I still need to introduce active mq bean and
>>>>> broker:
>>>>>
>>>>>   <bean id="activemq"
>>>>> class="org.apache.activemq.camel.component.ActiveMQComponent"
>>>>> depends-on="my-broker">
>>>>>               <property name="brokerURL" value="tcp://localhost:61616" />
>>>>>   </bean>
>>>>>
>>>>>   <broker:broker id="my-broker" useJmx="false" persistent="false"
>>>>> brokerName="localhost">
>>>>>       <broker:transportConnectors>
>>>>>           <broker:transportConnector uri="tcp://localhost:61616"/>
>>>>>       </broker:transportConnectors>
>>>>>   </broker:broker>
>>>>>
>>>>> ? Those are not included the quickstart blueprint xml file (probably
>>>>> since it is assumed they are configured somewhere else?).
>>>>>
>>>>> On Tue, Mar 8, 2011 at 6:53 PM, Gert Vanthienen
>>>>> <[email protected]> wrote:
>>>>>> L.S,
>>>>>>
>>>>>> What version of ServiceMix are you using for this scenario?  In some
>>>>>> other post, I see you mention 4.3.0 but this features.xml file seems
>>>>>> to indicate that you're using 4.2.0.  In ServiceMix 4.3.0, camel-jms
>>>>>> and activemq-camel are both preinstalled.  As far as 4.3.0 is
>>>>>> concerned, our new quickstart guide has a similar example that just
>>>>>> seems to work out of the box for me (cfr.
>>>>>> http://servicemix.apache.org/docs/4.3.0-SNAPSHOT/quickstart/activemq.html).
>>>>>>
>>>>>> Could you paste the output for the osgi:headers command for the bundle
>>>>>> you're deploying and I'll try to add a similar example using bundles
>>>>>> instead of plain XML files to our Camel guide?
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Gert Vanthienen
>>>>>> ------------------------
>>>>>> FuseSource
>>>>>> Web: http://fusesource.com
>>>>>> Blog: http://gertvanthienen.blogspot.com/
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Tue, Mar 8, 2011 at 3:26 PM, janne postilista
>>>>>> <[email protected]> wrote:
>>>>>>> Camel's ActiveMQ component http://camel.apache.org/activemq.html lists
>>>>>>> that it needs dependencies:
>>>>>>>
>>>>>>>    * camel-jms
>>>>>>>    * activemq-camel
>>>>>>>
>>>>>>> If I would be running Camel in standalone environment, I guess I would
>>>>>>> be putting those as maven pom dependencies (examples in
>>>>>>> http://camel.apache.org/activemq.html)
>>>>>>>
>>>>>>> But since I am running my solution as OGSi bundle deployed in
>>>>>>> ServiceMix, I am not sure. Should I put those as maven pom.xml
>>>>>>> dependencies, or reference the OSGi bundles that already exist in
>>>>>>> ServiceMix?
>>>>>>>
>>>>>>> - what do I put in my maven pom.xml dependencies, what in
>>>>>>> maven-bundle-plugin Import-Packages?
>>>>>>> - are there any configuration examples / documentation on how to
>>>>>>> configure servicemix OSGi bundle that contains camel route which uses
>>>>>>> camel activemq component?
>>>>>>>
>>>>>>> camel-osgi example starts with pom.xml with:
>>>>>>>
>>>>>>>    <dependencies>
>>>>>>>        <dependency>
>>>>>>>            <groupId>commons-logging</groupId>
>>>>>>>            <artifactId>commons-logging</artifactId>
>>>>>>>            <scope>provided</scope>
>>>>>>>        </dependency>
>>>>>>>        <dependency>
>>>>>>>            <groupId>org.apache.camel</groupId>
>>>>>>>            <artifactId>camel-spring</artifactId>
>>>>>>>            <version>${camel.version}</version>
>>>>>>>        </dependency>
>>>>>>>    </dependencies>
>>>>>>>
>>>>>>>    <build>
>>>>>>>        <plugins>
>>>>>>>            <plugin>
>>>>>>>                <groupId>org.apache.felix</groupId>
>>>>>>>                <artifactId>maven-bundle-plugin</artifactId>
>>>>>>>                <configuration>
>>>>>>>                    <instructions>
>>>>>>>
>>>>>>> <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
>>>>>>>                        
>>>>>>> <Import-Package>*,org.apache.camel.osgi</Import-Package>
>>>>>>>
>>>>>>> <Private-Package>org.apache.servicemix.examples.camel</Private-Package>
>>>>>>>                    </instructions>
>>>>>>>                </configuration>
>>>>>>>            </plugin>
>>>>>>>        </plugins>
>>>>>>>    </build>
>>>>>>>
>>>>>>> How should I change it? Seems that no matter whether I add
>>>>>>> org.apache.camel.component.jms to Import-Packages, or add
>>>>>>>
>>>>>>>                <dependency>
>>>>>>>                        <groupId>org.apache.camel</groupId>
>>>>>>>                        <artifactId>camel-jms</artifactId>
>>>>>>>                        <version>${camel.version}</version>
>>>>>>>                </dependency>
>>>>>>>
>>>>>>> I always get java.lang.ClassNotFoundException:
>>>>>>> org.apache.camel.component.jms.JmsComponent when I try to deploy my
>>>>>>> bundle.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Mar 8, 2011 at 2:35 PM, janne postilista
>>>>>>> <[email protected]> wrote:
>>>>>>>> I'm trying to run a simple camel test route which reads files from a
>>>>>>>> directory, puts them into an ActiveMQ queue, and another one reads the
>>>>>>>> files from the queue and writes them to another directory.
>>>>>>>>
>>>>>>>> I took examples/camel-osgi and started building on top of it.
>>>>>>>>
>>>>>>>> beans.xml:
>>>>>>>>
>>>>>>>>    <route>
>>>>>>>>      <from uri="activemq:queue:someq"/>
>>>>>>>>      <to uri="file:d:/servicemix-files/out" />
>>>>>>>>    </route>
>>>>>>>>    <route>
>>>>>>>>      <from uri="file:d:/servicemix-files/in"/>
>>>>>>>>      <to uri="activemq:queue:someq"/>
>>>>>>>>    </route>
>>>>>>>>
>>>>>>>>    <bean id="activemq"
>>>>>>>> class="org.apache.activemq.camel.component.ActiveMQComponent"
>>>>>>>> depends-on="my-broker">
>>>>>>>>                <property name="brokerURL" 
>>>>>>>> value="tcp://localhost:61616" />
>>>>>>>>    </bean>
>>>>>>>>
>>>>>>>>    <broker:broker id="my-broker" useJmx="false" persistent="false"
>>>>>>>> brokerName="localhost">
>>>>>>>>        <broker:transportConnectors>
>>>>>>>>            <broker:transportConnector uri="tcp://localhost:61616"/>
>>>>>>>>        </broker:transportConnectors>
>>>>>>>>    </broker:broker>
>>>>>>>>
>>>>>>>> At first I got a bunch of osgi "unresolved constraint in bundle
>>>>>>>> camel-osgi errors". After a while of trial and error I ended up with
>>>>>>>> following changes:
>>>>>>>>
>>>>>>>> features.xml:
>>>>>>>>
>>>>>>>>    <feature name="examples-camel-osgi" version="4.2.0">
>>>>>>>>        <feature version="2.2.0">camel</feature>
>>>>>>>>        <feature version="5.3.0">activemq</feature>
>>>>>>>>        <feature version="4.2.0">camel-activemq</feature>
>>>>>>>>        
>>>>>>>> <bundle>mvn:org.apache.servicemix.examples/camel-osgi/4.2.0</bundle>
>>>>>>>>    </feature>
>>>>>>>>
>>>>>>>> pom.xml:
>>>>>>>>                <artifactId>maven-bundle-plugin</artifactId>
>>>>>>>>  ...
>>>>>>>>
>>>>>>>> <Import-Package>*,org.apache.camel.component.jms,org.apache.activemq.xbean,org.apache.camel.osgi,org.apache.activemq.camel.component,org.apache.activemq.broker,org.apache.activemq.pool</Import-Package>
>>>>>>>>
>>>>>>>> But still I do get a ClassNotFoundException when I try to deploy  the 
>>>>>>>> feature:
>>>>>>>>
>>>>>>>> Caused by: 
>>>>>>>> org.springframework.beans.factory.CannotLoadBeanClassException:
>>>>>>>> Error loading class
>>>>>>>> [org.apache.activemq.camel.component.ActiveMQComponent] for bean with
>>>>>>>> name 'activemq' defined in URL [bun
>>>>>>>> dle://222.0:0/META-INF/spring/beans.xml]: problem with class file or
>>>>>>>> dependent class; nested exception is java.lang.NoClassDefFoundError:
>>>>>>>> org.apache.activemq.camel.component.ActiveMQComponent not foun
>>>>>>>> d from bundle [Apache ServiceMix Example :: Camel OSGi (camel-osgi)]
>>>>>>>>        at 
>>>>>>>> org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1144)
>>>>>>>> ....
>>>>>>>> Caused by: java.lang.ClassNotFoundException:
>>>>>>>> org.apache.camel.component.jms.JmsComponent
>>>>>>>>
>>>>>>>> 1) What do I need to do to fix this ClassNotFoundException
>>>>>>>> 2) How can I know what I need to configure into features.xml, pom.xml
>>>>>>>> import-packages and dependencies when I want to use camel and it's
>>>>>>>> activemq component from servicemix? Is this information documented
>>>>>>>> somewhere? Doing it by trial-and-error gets frustrating pretty fast...
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to