camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raul Kripalani <r...@fusesource.com>
Subject Re: using MessageConverter with Bean
Date Fri, 23 Mar 2012 17:17:02 GMT
I don't think you need a message converter for that. Why don't you try
setting the JMSType header after the inOut invocation to the bean? For
example:

@Override
public void configure(){
       from(IN_QUEUE).choice()
       .when(header("JMSType").isEqualTo("CommandType"))
           .inOut("bean:messageListener?method=handleMessage")
           .setHeader("JMSType").simple("${body.getClass.getCanonicalName}")
       .otherwise()
           .to("activemq:myqueue.in.DLQ")
       .routeId("jms-my-route");
}

That should do the trick...

Regards,

*Raúl Kripalani*
Principal Consultant | FuseSource Corp.
raul@fusesource.com | fusesource.com <http://www.fusesource.com/> skype:
raul.fuse | twitter: @raulvk <http://twitter.com/raulvk>,
@fusenews<http://twitter.com/fusenews>


On 22 March 2012 16:08, Xuan Huang <Xuan.Huang@gamesys.co.uk> wrote:

> Hi,
>
> I have in my RouteBuilder something like this:
>
> public class MyRouteBuilder extends RouteBuilder{
> private static final String IN_QUEUE="activemq:
> myqueue.in?messageConverter=#myMessageConverter";
>
> @Override
> public void configure(){
>        from(IN_QUEUE).choice()
>        .when(header("JMSType").isEqualTo("CommandType"))
>        .inOut("bean:messageListener?method=handleMessage")
>        .otherwise().to("activemq:myqueue.in.DLQ")
>        .routeId("jms-my-route");
> }
>
> }
>
> The handleMessage method in MessageListener processes the input and
> generates a POJO which is set to the message body, but the Type in the JMS
> header is not set to the proper return type. What is the proper way of
> setting the message converter for the reply message?
>
> Regards,
> xuan

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message