camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Strachan <james.strac...@gmail.com>
Subject Re: Using @Produce / @Consume -- What am I missing?
Date Mon, 14 Sep 2009 15:07:10 GMT
2009/9/14 Scott Parkerson <Scott.Parkerson@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/

Mime
View raw message