On Thu, 2009-09-10 at 10:10 +0200, Christian Schneider wrote:

> Ok .. now I understand. You want to send the pojo to ActiveMQ not the 
> xml. In this case you build the service with CXF and can then use
> Camel to simply send the pojo to ActiveMQ. You can do this by:
> 
> public class MyJsonServiceImpl implements MyJsonService {
>   @EndpointInject(uri="activemq:myqueue")
>   ProducerTemplate producer;
> 
>   public void doSomething(MyObject o) {
>     producer.sendBody(o);
>   }
> }

Ok, this is closer to what I want, but not quite there. I'm using the
example from the pojo-producing page, and sending the result to a seda
queue which is then picked up by a content-based router. Here's the
code:

(the interface code)

@InOnly
    public interface WebRequestProducer
    {
        public void sendToWebRouter(Object o);
    }

(the webrouter configuration) 

    public void configure() throws Exception
    {      
        
        getContext().addInterceptStrategy(new Tracer());
        
        from("seda:webrequestqueue")
            .choice()
                .when(body().isInstanceOf(SendSMSRequest.class))
                    .to("activemq:queue:send_sms_req")
                .when(body().isInstanceOf(IncomingSMSRequest.class))
                    .to("activemq:queue:inc_sms_req")
                .otherwise().throwFault("Blah." +
body().toString());        
    }

(and finally, the CXF method that calls it)

    @Produce(uri = "seda:webrequestqueue")
    private WebRequestProducer  webRequestProducer;

    @POST
    @Path("/sendfoo")
    public Response sendFoo(SendFooRequest sendFooRequest)
    {        
       
        // TODO: validation code, etc.
        webRequestProducer.sendToWebRouter(sendFooRequest);
        
        // Return HTTP response 202 Accepted
        return Response.status(202).build();

    }



Problem is, my message that is generated is a BeanInvocation message
containing the abstract method invocation, not *just* the POJO. 

I'm beginning to think I've got the wrong approach to this, but humor me
and tell me how I can just send the Foo object.

--sgp

Reply via email to