Re: Using @Produce / @Consume -- What am I missing?
2009/9/14 Scott Parkerson scott.parker...@ateb.com: Hello, I'm trying to use Camel 1.6.1 in SMX 4.1.0.2 (FUSE) and the POJO Producing / Consuming annotations as described in the online documentation. In one class (a CXF-based RESTful webservice), I have the following set up: // OutboundFooRequestHandler is an interface (see below) �...@produce(uri=activemq:queue:outbound_foo_req) private OutboundFooRequestHandler outboundFooRequestHandler; �...@post �...@path(/sendfoo) public Response sendFoo(OutboundFooRequest sendFooRequest) { // (a bunch of web-specific code deleted) // send this sendFooReqest object on the queue outboundFooRequestHandler.handle(sendFooRequest); // Return HTTP response 202 Accepted return Response.status(202).build(); } The interface that is annotated with Produce is shown below: @InOnly public interface OutboundFooRequestHandler { public void handle(OutboundFooRequest outboundFooRequest); } Here is the implementation of the interface: public class OutboundFooRequestHandlerImpl implements OutboundFooRequestHandler, InitializingBean, DisposableBean { private static final Logger logger = LoggerFactory.getLogger(OutboundFooRequestHandlerImpl.class); �...@override �...@consume(uri=activemq:queue:outbound_foo_req) public void handle(@Body OutboundFooRequest outboundFooRequest) { logger.debug(got it); // TODO: actually *do* something } The producer and the consumer's bundle-context.xml has this: camelContext xmlns=http://activemq.apache.org/camel/schema/spring; / bean name=activemq class=org.apache.camel.component.jms.JmsComponent property name=connectionFactory bean class=org.apache.activemq.ActiveMQConnectionFactory property name=brokerURL value=vm://default / /bean /property /bean I can send a message, but the consumer doesn't wake up and pick up the message. It's worth noting that the producer and the consumer are in two different bundles. What am I missing? Are you creating your OutboundFooRequestHandlerImpl class by configuring it in Spring XML? Or are you using the Spring 3 component scan stuff? -- James --- http://macstrac.blogspot.com/ Open Source Integration http://fusesource.com/
Re: Using @Produce / @Consume -- What am I missing?
On Mon, 2009-09-14 at 16:07 +0100, James Strachan wrote: Are you creating your OutboundFooRequestHandlerImpl class by configuring it in Spring XML? Or are you using the Spring 3 component scan stuff? Well, that question made me realize that I need to instantiate the bean via Spring. Turns out two things were missing: 1. I needed to configure the Impl class in my bean, thusly: bean name=outboundFooProcessor class=com.ateb.dataproc.obc_processor.internal.OutboundFooRequestHandlerImpl / 2. I needed to configure the Apache Maven plugin to add the package com.ateb.dataproc.obc_processor.internal to Private-Package in my POM. Now, I have a new issue: Upon each message consumed, this is spewed to SMX's console: com.ateb.dataproc.obc_processor.internal 11:26:11,796 | WARN | nerContainer-240 | DefaultMessageListenerContainer | AbstractMessageListenerContainer 646 | Execution of JMS message listener failed org.apache.camel.RuntimeCamelException: org.apache.camel.component.jms.RuntimeJmsException: Failed to extract body due to: javax.jms.JMSException: Failed to build body from content. Serializable class not available to broker. Reason: java.lang.ClassNotFoundException: org.apache.camel.component.bean.BeanInvocation. So, evidently, something needs to be added to my bundle's classpath via the pom.xml? Or am I missing the component? --sgp