You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Andrej Siebert <an...@mixtour.net> on 2008/11/25 17:02:06 UTC

Problem with @Produce annotation

hello everybody,

i have a problem with new camel-annotations.

[short description of the problem]: i've implemented a producer bean like in
the example (see chapter "bean integration/producing POJOs"). but neither
the Producer-Object  (annotated with @Produce) nor the ProducerTemplate
(annotated with @EndpointInject) is setted.

system: activemq v5.1.0; camel v1.5.0; spring v2.5.5; broker is running in a
tomcat v6.x; jdk v1.6.x; and some other stuff (not important in this case).

code snippets:
=======================
Bean ::: 

public class ServiceRegistrationBean implements CamelContextAware {

	@EndpointInject(uri="ajms:queue:com.officeloop.jms.sys.registration" )
	public ProducerTemplate<Exchange> producer;

	@Produce(uri="ajms:queue:com.officeloop.jms.sys.registration")
	public ServiceManagerListener listener;

	public void registerMe( ) {
		System.out.println( ">>> send configuration ::: "  + this.listener + " 
producer ::: " + this.producer);
//
//		listener.register( "myServerId" );
	}
}

Spring-Config:::

i've added to my spring.xml the bean-configuration &
camel-context-configuration:

<bean id="serverRegistrationBean"
class="com.officeloop.camel.routes.ServiceRegistrationBean" >
		<property name="serverConfiguration" ref="serverConfig" />
</bean>

Interface:::
public interface ServiceManagerListener {

	public void register(final String serverId);

}


Additional information:
+ spring-app-context is loaded correctly, without exceptions
+ camel-trasport for soap over jms works well
+ camel-context is loaded
+ my rout-builder-klasses are instantiated
+ but the field annotated with @Produce is NULL.


something is wrong. but what?

thanx, Andrej

-- 
View this message in context: http://www.nabble.com/Problem-with-%40Produce-annotation-tp20684118s22882p20684118.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Problem with @Produce annotation

Posted by James Strachan <ja...@gmail.com>.
What does your full spring.xml look like? e.g. are you defining a
<camelContext/> ?

2008/11/25 Andrej Siebert <an...@mixtour.net>:
>
> hello everybody,
>
> i have a problem with new camel-annotations.
>
> [short description of the problem]: i've implemented a producer bean like in
> the example (see chapter "bean integration/producing POJOs"). but neither
> the Producer-Object  (annotated with @Produce) nor the ProducerTemplate
> (annotated with @EndpointInject) is setted.
>
> system: activemq v5.1.0; camel v1.5.0; spring v2.5.5; broker is running in a
> tomcat v6.x; jdk v1.6.x; and some other stuff (not important in this case).
>
> code snippets:
> =======================
> Bean :::
>
> public class ServiceRegistrationBean implements CamelContextAware {
>
>        @EndpointInject(uri="ajms:queue:com.officeloop.jms.sys.registration" )
>        public ProducerTemplate<Exchange> producer;
>
>        @Produce(uri="ajms:queue:com.officeloop.jms.sys.registration")
>        public ServiceManagerListener listener;
>
>        public void registerMe( ) {
>                System.out.println( ">>> send configuration ::: "  + this.listener + "
> producer ::: " + this.producer);
> //
> //              listener.register( "myServerId" );
>        }
> }
>
> Spring-Config:::
>
> i've added to my spring.xml the bean-configuration &
> camel-context-configuration:
>
> <bean id="serverRegistrationBean"
> class="com.officeloop.camel.routes.ServiceRegistrationBean" >
>                <property name="serverConfiguration" ref="serverConfig" />
> </bean>
>
> Interface:::
> public interface ServiceManagerListener {
>
>        public void register(final String serverId);
>
> }
>
>
> Additional information:
> + spring-app-context is loaded correctly, without exceptions
> + camel-trasport for soap over jms works well
> + camel-context is loaded
> + my rout-builder-klasses are instantiated
> + but the field annotated with @Produce is NULL.
>
>
> something is wrong. but what?
>
> thanx, Andrej
>
> --
> View this message in context: http://www.nabble.com/Problem-with-%40Produce-annotation-tp20684118s22882p20684118.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Re: Problem with @Produce annotation

Posted by Andrej Siebert <an...@mixtour.net>.
the usual way over 

p = camelContext.getProducerTemplate( );
e = camelContext.getEndpoint( "direct:registerServer"  );

p.sendBody( e, "some txt" );

works fine...

@Consume-annotation, used on the other side, works also well. 

any explanations?


-- 
View this message in context: http://www.nabble.com/Problem-with-%40Produce-annotation-tp20684118s22882p20685085.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Problem with @Produce annotation

Posted by Andrej Siebert <an...@mixtour.net>.
My camel-context is configured in this way:

<!-- Camel-Context ::: -->
	<camelContext id="camel" trace="true"
		xmlns="http://activemq.apache.org/camel/schema/spring">
        <camel:package>${route.package}</camel:package>

        <beanPostProcessor />

        <!-- i have a bean with id="rout", is a route-builder with some
spring-injections -->
        <camel:routeBuilderRef ref="route" />

	</camelContext>


i've also tried to declare an endpoint in camel-context with
camel:endpoint-tag. used adres is the same like in the bean above (see
EndpointInject-Annotation)


-- 
View this message in context: http://www.nabble.com/Problem-with-%40Produce-annotation-tp20684118s22882p20684873.html
Sent from the Camel - Users mailing list archive at Nabble.com.