'm just now moving a project to blueprint, here is an example camel setup that 
works really well (Thanks jgenender)

This is using aries JNDI/transaction and persistence.


<?xml version="1.0" encoding="UTF-8"?>
<blueprint default-activation="lazy"
          xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
          xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0";
          xmlns:camel-bp="http://camel.apache.org/schema/blueprint";
          xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0";
          xsi:schemaLocation="
           http://www.osgi.org/xmlns/blueprint/v1.0.0 
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
           http://camel.apache.org/schema/blueprint 
http://camel.apache.org/schema/blueprint.xsd
           ">

 <cm:property-placeholder persistent-id="wcsri">

   <cm:default-properties>

     <!-- Security -->
     <cm:property name="wcs.securityEnabled" value="false"/>
     <cm:property name="wcs.securityRealm" value="nnew"/>

     <!-- AMQ specific -->
     <cm:property name="amq.http.connector.url" value="tcp://localhost:61616"/>
     <cm:property name="submgt.abandoned.days" value="30"/>
     <cm:property name="submgt.deleted.hold.days" value="15"/>
     <cm:property name="submgt.transformer.list"
                  value="DESCRIPTION 
COVERAGE|jms:queue:pubsub.xformer.DescribeCoverage,GET 
COVERAGE|jms:queue:pubsub.xformer.GetCoverage"/>

   </cm:default-properties>

 </cm:property-placeholder>

 <camel-bp:camelContext xmlns="http://camel.apache.org/schema/blueprint"; 
id="sub-management">
   <!-- Handles the ack messages -->
   <route>
     <from uri="jms:topic:ActiveMQ.Advisory.MessageConsumed.TempQueue.>"/>
     <to uri="ackProcessor"/>
   </route>
   <!-- Handles the queue access/disconnect messages -->
   <route>
     <from uri="jms:topic:ActiveMQ.Advisory.TempQueue"/>
     <to uri="connectionProcessor"/>
   </route>
   <!-- Handles the handshake -->
   <route>
     <from uri="jms:queue:pubsub.handshake"/>
     <to uri="handshakeProcessor"/>
   </route>
   <!-- Handles the cleanup of the subscription meta data -->
   <route>
     <!-- Fire quartz every 5 minutes -->
     <from uri="timer://foo?fixedRate=true&amp;period=600000"/>
     <!--
     <from uri="quartz://cleanup?cron=0+0/5+*+*+*+?"/>
     -->
     <to uri="cleanupProcessor"/>
   </route>
 </camel-bp:camelContext>

 <bean id="transformerHandler" 
class="edu.ucar.ral.wcsri.pubsub.sm.hidden.TransformerHandler">
   <argument value="${submgt.transformer.list}"/>
 </bean>

 <!-- TransformerInformation -->
 <bean id="transformerInformationService" 
class="edu.ucar.ral.wcsri.pubsub.sm.TransformerInformationServiceImpl">
   <property name="transformerHandler" ref="transformerHandler"/>
 </bean>

 <!-- Authentication Service -->
 <bean id="jaasAuthenticationService" 
class="edu.ucar.ral.security.jaas.authentication.JAASAuthenticationService"/>

 <!-- Ack Processor -->
 <bean id="ackProcessor" 
class="edu.ucar.ral.wcsri.pubsub.sm.hidden.AckProcessor">
   <property name="messageDAO" ref="messageDAO"/>
   <property name="eventProducerId" value="AckProcessor"/>
   <property name="eventProducerDAO" ref="eventProducerDAO"/>
   <property name="idempotentRepository" ref="idempotentRepository"/>
   <tx:transaction method="process*" value="Required"/>
 </bean>

 <!-- Connection Processor -->
 <bean id="connectionProcessor" 
class="edu.ucar.ral.wcsri.pubsub.sm.hidden.ConnectionProcessor">
   <property name="subscriptionDAO" ref="subscriptionDAO"/>
   <property name="eventProducerId" value="ConnectionProcessor"/>
   <property name="eventProducerDAO" ref="eventProducerDAO"/>
   <property name="idempotentRepository" ref="idempotentRepository"/>
   <tx:transaction method="process*" value="Required"/>
 </bean>

 <!-- Handshake Processor -->
 <bean id="handshakeProcessor" 
class="edu.ucar.ral.wcsri.pubsub.sm.hidden.HandshakeProcessor">
   <property name="subscriptionDAO" ref="subscriptionDAO"/>
   <property name="messageDAO" ref="messageDAO"/>
   <property name="jmsTemplate" ref="jmsTemplate"/>
   <property name="securityEnabled" value="${wcs.securityEnabled}"/>
   <property name="securityRealm" value="${wcs.securityRealm}"/>
   <property name="authenticationService" ref="jaasAuthenticationService"/>
   <property name="streamingFactory" ref="streamingFactory"/>
   <tx:transaction method="process*" value="Required"/>
 </bean>

 <!-- Cleanup Processor -->
 <bean id="cleanupProcessor" 
class="edu.ucar.ral.wcsri.pubsub.sm.hidden.CleanupProcessor">
   <property name="abandonedDays" value="${submgt.abandoned.days}"/>
   <property name="deletedHoldDays" value="${submgt.deleted.hold.days}"/>
   <property name="subscriptionDAO" ref="subscriptionDAO"/>
   <property name="messageDAO" ref="messageDAO"/>
   <property name="eventProducerId" value="CleanupProcessor"/>
   <property name="eventProducerDAO" ref="eventProducerDAO"/>
   <property name="idempotentRepository" ref="idempotentRepository"/>
   <tx:transaction method="process*" value="Required"/>
 </bean>

 <!-- Spring JMS Template -->
 <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
   <property name="connectionFactory" ref="jmsConnectionPool"/>
 </bean>

 <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
   <property name="connectionFactory" ref="jmsConnectionPool"/>
   <property name="transacted" value="true"/>
   <!--
   Hrm... what do we do about this?
   <property name="transactionManager" ref="transactionManager"/>
   -->
 </bean>

 <!-- Subscribe service handler  -->
 <bean id="subscribeRequestHandler" 
class="edu.ucar.ral.wcsri.pubsub.sm.handler.SubscribeRequestHandler">
   <property name="subscriptionDAO" ref="subscriptionDAO"/>
   <property name="brokerURL" value="${amq.http.connector.url}"/>
   <tx:transaction method="handle*" value="Required"/>
 </bean>

 <!-- Subscription management service handler  -->
 <bean id="subscriptionManagementRequestHandler"
       
class="edu.ucar.ral.wcsri.pubsub.sm.handler.SubscriptionManagementRequestHandler">
   <property name="subscriptionDAO" ref="subscriptionDAO"/>
   <tx:transaction method="handle*" value="Required"/>
 </bean>

 <reference id="transactionManager" 
interface="org.springframework.transaction.PlatformTransactionManager"/>

 <reference id="streamingFactory" 
interface="edu.ucar.ral.wcsri.pubsub.persistence.dao.StreamingFactory"/>

 <reference id="messageDAO" 
interface="edu.ucar.ral.wcsri.pubsub.persistence.dao.MessageDAO"/>

 <reference id="subscriptionDAO" 
interface="edu.ucar.ral.wcsri.pubsub.persistence.dao.SubscriptionDAO"/>

 <reference id="eventProducerDAO" 
interface="edu.ucar.ral.wcsri.pubsub.persistence.dao.EventProducerDAO"/>

 <reference id="idempotentDAO" 
interface="edu.ucar.ral.wcsri.pubsub.persistence.dao.IdempotentDAO"/>

 <reference id="versionDAO" 
interface="edu.ucar.ral.wcsri.pubsub.persistence.dao.VersionInfoDAO"/>

 <reference id="idempotentRepository" 
interface="org.apache.camel.spi.IdempotentRepository"/>

 <reference id="jmsConnectionPool" interface="javax.jms.ConnectionFactory" 
filter="(wcsri=true)"/>

 <service ref="transformerInformationService" 
interface="edu.ucar.ral.wcsri.pubsub.sm.TransformerInformationService"/>

 <service ref="subscribeRequestHandler" 
interface="edu.ucar.ral.wcsri.pubsub.sm.handler.SubscriptionRequestHandler"/>

 <service ref="subscriptionManagementRequestHandler" 
interface="edu.ucar.ral.wcsri.pubsub.sm.handler.SubscriptionRequestHandler"/>

</blueprint>

On Mar 9, 2011, at 7:35 PM, Freeman Fang wrote:

> One solution I can come up with which might not be graceful but working is 
> that in your xml camel-routers hold a osgi reference exposed by the camel 
> component you want to wait, this can ensure the camel components fully 
> started before your customer router bundle.
> For example if you need ensure camel-restlet fully started, just put
> 
> <osgi:reference id="restlet" 
> interface="org.apache.camel.spi.ComponentResolver"
> cardinality="1..1" filter="(component=restlet)" />
> in your customer router bundle camel xml.
> 
> Freeman
> 
> 
> On 2011-3-9, at 下午11:05, Guillaume Nodet wrote:
> 
>> I've seen lots of problems when using spring-dm, some of them do not
>> have any clean solution *at all*, especially when using custom
>> namespace handlers such as camel.  That's why I've been advocating for
>> using blueprint instead, which works way better.
>> 
>> Camel support for blueprint is much better since 2.6 and 2.7 will
>> bring another set of improvements, so if that's an option, i'd switch
>> to blueprint.
>> Else, well, you can always try to put some Thread.sleep at some very
>> fined tuned location in order to make sure the camel namespace handler
>> is ready and that all camel components are available.
>> 
>> On Wed, Mar 9, 2011 at 15:51, Michael Prieß
>> <[email protected]> wrote:
>>> Hi all,
>>> 
>>> i like to deploy camel-routes and features inside the deploy directory.
>>> 
>>>  A deployment look like the following:
>>> 
>>> - a feature.xml which contain bundles like Apache Camel, Spring with a start
>>> level definition.
>>> - and many xml camel-routes which contain configurations for my components.
>>> 
>>> Now i have the problem that my camel-routes have the same start level like
>>> the features.
>>> 
>>> Have anyone a good idea how to resolve the problem?
>>> 
>>> Regards,
>>> 
>>> Michael Priess
>>> 
>>> 
>>> 
>> 
>> 
>> 
>> -- 
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>> ------------------------
>> Open Source SOA
>> http://fusesource.com
> 
> 
> -- 
> Freeman Fang
> 
> ------------------------
> 
> FuseSource: http://fusesource.com
> blog: http://freemanfang.blogspot.com
> twitter: http://twitter.com/freemanfang
> Apache Servicemix:http://servicemix.apache.org
> Apache Cxf: http://cxf.apache.org
> Apache Karaf: http://karaf.apache.org
> Apache Felix: http://felix.apache.org
> 

Reply via email to