camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Camillo <alancami...@gmail.com>
Subject TypeConversionException RabbitMQ
Date Tue, 09 Dec 2014 04:48:43 GMT
Look like a simple problem, but I can't see the solution.

I have a class like the follow:
public class A {
    public List<B> Bs;
    // getters and setters
}

Than I receive this class from a RabbitMQ:

from("rabbitmq://{{rabbitmq.host}}:{{rabbitmq.port}}/*sendmsg*
").routeId("sendmsg")
       .convertBodyTo(A.class)
       .setHeader("BODY", new SimpleExpression("${body}"))
       .setHeader("SIZE", new SimpleExpression("${body.bs.size}"))
       .loop(new SimpleExpression("${header.SIZE}") )
               .log("contador: ${header.CamelLoopIndex}")
               .process(new IterateEmailsProcessor())    //<<<<<<<<<
Here I
put a *B.class* in the body to send to another process and I get the error
               .inOnly("rabbitmq://{{rabbitmq.host}}:{{rabbitmq.port}}/
*othermsg*") //<<<<<<<<<< Exception came from here
       .end() ;

Caused by: [org.apache.camel.TypeConversionException - Error during type
conversion from type: byte[] to the required type: *A* with value
[B@2aa6b2f7 due Cannot cast *B* to *A*]

Can't I exchange different types through rabbitmq component?
Thank you!
Alan Camillo

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