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: use of splitter component to split serialised JaxB
Date Wed, 06 Jun 2007 18:09:47 GMT
On 5/31/07, Nick Outram <apache@nickoutram.name> wrote:
>
> I've been struggling to use the splitter component to split an incoming JaxB
> representation of an order message into its constituent transactions; the
> message is coming from an activemq endpoint. After hours of wandering
> through twisty little generics all alike... I think I've done my brain some
> damage and could do with an example if somebody knows if it's possible any
> takers? :)

LOL

So I guess the main thing is to write the Expression to extract the
items from the order. Since these are Jaxb POJOs you might wanna use
something like ruby/groovy/jxpath or something. It might be easiest to
start off with just writing a Java Expression....

from("activemq:someQueue").splitter(new Expression<Exchange>() {
  public Object evaluate(Exchange exchange) {
     Order order = exchange.getIn().getBody(Order.class);
     return order..getLineItems();
  }
}).to("activemq:anotherQueue");

you could wrap this expression up in a helper method if you find it
useful in multiple rules. Once thats working, you could try a
groovy/beanshell/ruby alternative maybe?

-- 
James
-------
http://macstrac.blogspot.com/

Mime
View raw message