You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by segev <so...@gmail.com> on 2014/04/06 10:39:23 UTC

Referencing camel endpoint defined in the ‘blueprint’ XML does not appears to work

In previous camel projects (deployed to Tomcat)  I used the <camel:endpoint> 
to define endpoints and reference these from Routes in DSL.
 I am now experimenting with karaf & Fuse and using the ‘blueprint’ XML file
with ‘camel:endpoint’ does not appear to work.
The XMLs at the end of this message show the blueprint that failed and the
Spring XML that works.

Notes 
 I used the maven archetype blueprint and spring to generate the deployment
jar

 I am mainly interested in implementing the routes using DSL and defining
the ‘camel endpoint’ in the XML file.

Any information on how to define camel endpoint using blueprint will be
great.

----------------------------- blueprint 

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:camel="http://camel.apache.org/schema/blueprint"
       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/camel-blueprint.xsd">

  <bean id="helloBean" class="com.blss.test.AsTest03.HelloBean">
      <property name="say" value="Hi from Camel"/>
  </bean>
  
  <camel:endpoint id="timerX" uri="timer:foo?period=5000"/>

  <camelContext id="blueprintContext" trace="false"
xmlns="http://camel.apache.org/schema/blueprint">
    <route id="timerToLog">
      <from ref="timerX"/>
      <setBody>
          <method ref="helloBean" method="hello"/>
      </setBody>
      <log message="The message contains ${body}"/>
      <to uri="mock:result"/>
    </route>
  </camelContext>

</blueprint>

------------------------------------- Spring works OK

<?xml version="1.0" encoding="UTF-8"?>


<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:camel="http://camel.apache.org/schema/spring"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
       http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">

  <bean id="helloBean" class="com.blss.test.AsTest04.HelloBean">
      <property name="say" value="Hi from Camel"/>
  </bean>
  
  <camel:endpoint id="timerX" uri="timer:foo?period=5000"/>

  <camel:camelContext xmlns="http://camel.apache.org/schema/spring">

    <route id="timerToLog">
      <from ref="timerX"/>
      <setBody>
          <method ref="helloBean" method="hello"/>
      </setBody>
      <log message="The message contains ${body}"/>
      <to uri="mock:result"/>
    </route>
    
  </camel:camelContext>

</beans>





--
View this message in context: http://camel.465427.n5.nabble.com/Referencing-camel-endpoint-defined-in-the-blueprint-XML-does-not-appears-to-work-tp5749850.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Referencing camel endpoint defined in the 'blueprint' XML does not appears to work

Posted by segev <so...@gmail.com>.
Just a note on adding Java DSL, I had to place the <packageScan> before the
endpoint definition to get it to work. It will be good if the camel page
'using-osgi-blueprint-with-camel' will highlight the differences between
'blueprint' XML and 'spring' XML (currently it suggests similarity). 



--
View this message in context: http://camel.465427.n5.nabble.com/Referencing-camel-endpoint-defined-in-the-blueprint-XML-does-not-appears-to-work-tp5749850p5749856.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Referencing camel endpoint defined in the 'blueprint' XML does not appears to work

Posted by segev <so...@gmail.com>.
Works fine now.

Thanks for that 



--
View this message in context: http://camel.465427.n5.nabble.com/Referencing-camel-endpoint-defined-in-the-blueprint-XML-does-not-appears-to-work-tp5749850p5749855.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Referencing camel endpoint defined in the 'blueprint' XML does not appears to work

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Can you try put <endpoint> inside <camelContext>

On Sun, Apr 6, 2014 at 10:39 AM, segev <so...@gmail.com> wrote:
>
> In previous camel projects (deployed to Tomcat)  I used the <camel:endpoint>
> to define endpoints and reference these from Routes in DSL.
>  I am now experimenting with karaf & Fuse and using the 'blueprint' XML file
> with 'camel:endpoint' does not appear to work.
> The XMLs at the end of this message show the blueprint that failed and the
> Spring XML that works.
>
> Notes
>  I used the maven archetype blueprint and spring to generate the deployment
> jar
>
>  I am mainly interested in implementing the routes using DSL and defining
> the 'camel endpoint' in the XML file.
>
> Any information on how to define camel endpoint using blueprint will be
> great.
>
> ----------------------------- blueprint
>
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xmlns:camel="http://camel.apache.org/schema/blueprint"
>        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/camel-blueprint.xsd">
>
>   <bean id="helloBean" class="com.blss.test.AsTest03.HelloBean">
>       <property name="say" value="Hi from Camel"/>
>   </bean>
>
>   <camel:endpoint id="timerX" uri="timer:foo?period=5000"/>
>
>   <camelContext id="blueprintContext" trace="false"
> xmlns="http://camel.apache.org/schema/blueprint">
>     <route id="timerToLog">
>       <from ref="timerX"/>
>       <setBody>
>           <method ref="helloBean" method="hello"/>
>       </setBody>
>       <log message="The message contains ${body}"/>
>       <to uri="mock:result"/>
>     </route>
>   </camelContext>
>
> </blueprint>
>
> ------------------------------------- Spring works OK
>
> <?xml version="1.0" encoding="UTF-8"?>
>
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xmlns:camel="http://camel.apache.org/schema/spring"
>        xsi:schemaLocation="
>        http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
>        http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd">
>
>   <bean id="helloBean" class="com.blss.test.AsTest04.HelloBean">
>       <property name="say" value="Hi from Camel"/>
>   </bean>
>
>   <camel:endpoint id="timerX" uri="timer:foo?period=5000"/>
>
>   <camel:camelContext xmlns="http://camel.apache.org/schema/spring">
>
>     <route id="timerToLog">
>       <from ref="timerX"/>
>       <setBody>
>           <method ref="helloBean" method="hello"/>
>       </setBody>
>       <log message="The message contains ${body}"/>
>       <to uri="mock:result"/>
>     </route>
>
>   </camel:camelContext>
>
> </beans>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Referencing-camel-endpoint-defined-in-the-blueprint-XML-does-not-appears-to-work-tp5749850.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io