You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Walzer, Thomas" <th...@integratix.net> on 2013/05/22 13:24:09 UTC

Blueprint/@Produce

Hi guys,

I would like to send a message from a pojo to a blueprint route (Camel 2.10).
Something along the lines:

----
package net.integratix.camel.blueprint;
public class ButtonProducer {
	@Produce(uri="direct:startRoute")
	ProducerTemplate producer;

	public void buttonPressed() {
		producer.sendBody("Hello, Camel!!!");
	}

}
----

<?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"
       xmlns:context="http://www.springframework.org/schema/context"
       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">
  
  <camel:contextScan>
	  <camel:includes>net.integratix.camel.blueprint</camel:includes>
  </camel:contextScan>
    <route autoStartup="true" trace="true" id="rtButton2World">
    	<from uri="direct:startRoute"/>
    	<log message="**** ${body} ***"/>
    </route>
</camelContext>
</blueprint>

----

When I run it, the route is started but no message arrives. I assume my bean is not instantiated.

Any hints?
Thanks! Thomas.

Re: Blueprint/@Produce

Posted by Christian Schneider <ch...@die-schneider.net>.
How do you initialize the ButtonProducer object?

I am not sure if the annotation works with blueprint but in spring you 
would have to create a spring bean for the ButtonProducer.

Christian

Am 22.05.2013 13:24, schrieb Walzer, Thomas:
> Hi guys,
>
> I would like to send a message from a pojo to a blueprint route (Camel 2.10).
> Something along the lines:
>
> ----
> package net.integratix.camel.blueprint;
> public class ButtonProducer {
> 	@Produce(uri="direct:startRoute")
> 	ProducerTemplate producer;
>
> 	public void buttonPressed() {
> 		producer.sendBody("Hello, Camel!!!");
> 	}
>
> }
> ----
>
> <?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"
>         xmlns:context="http://www.springframework.org/schema/context"
>         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">
>    
>    <camel:contextScan>
> 	  <camel:includes>net.integratix.camel.blueprint</camel:includes>
>    </camel:contextScan>
>      <route autoStartup="true" trace="true" id="rtButton2World">
>      	<from uri="direct:startRoute"/>
>      	<log message="**** ${body} ***"/>
>      </route>
> </camelContext>
> </blueprint>
>
> ----
>
> When I run it, the route is started but no message arrives. I assume my bean is not instantiated.
>
> Any hints?
> Thanks! Thomas.


-- 
  
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com