camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: Newbie: how to unmarshal and then route using object member value?
Date Fri, 15 May 2009 03:12:42 GMT
Hi

you could use the bean language[1] get the full control of the Body Object.
The route rule could be
from("TOPIC").convertBodyTo(Student.class).choice().expression(bean(MyBean.class,
"isGradeA"))....

public class MyBean {
  public boolean isGradeA(@Body Student student) {
  	...
  }
}
You can find more information about the Parameter Binding Annotations
here[2].

[1]http://camel.apache.org/bean-language.html
[2]http://camel.apache.org/parameter-binding-annotations.html

Enjoy your camel riding :)

Willem

uprooter wrote:
> Hello everyone, Thank you for this precious project.
> I'm trying to migrate traditional JMS processing to camel.
> I need to read from JMS topic and unmarshal to JAXB object. and then route
> according to an Enum value in that object.
> (e.g unmarshal XML to Student object and route by student.getGrade())
> I also like it if it will be possible to unmarshal only once.
> I tried starting with something like
> from("TOPIC").convertBodyTo(Student.class).choice()
> but I can't figure out how to make the ChoiceDefinition "know" my Student
> object
> What should I look for?
> 
> John.
> 


Mime
View raw message