Hi Peter,
the route looks good to me.
* The in-messages of the original exchange and the resource exchange are
always identical. The out-message of the resource exchange will contain
the result from 'direct:enrichMovie'.
* What message exchange pattern do you use when you test (print the
contents of) the 'direct:enrichMovie' route?
* Is the CinemaQueryAssembler thread-safe? You're doing parallel
processing of split messages.
Martin
Peter Maas schrieb:
Hi list,
I'm developing a proof-of-concept application using Camel 2.0.
Everything seems to work just find... except for the content-enricher.
Both the resource exchange passed to my AggregationStrategy look
identical. Whilst if I print the contents of the resource route I the
the correct xml in the exchange after calling the http service. My
routes look like this:
// split messages when received from the incoming mq
// enrich if move. Always stor in database
from("activemq:topic:incomingVPROGuide")
.split(vpro.xpath("//vpro:program")).parallelProcessing(true)
.choice()
.when(vpro.xpath("/vpro:progr...@ismovie = 'true']"))
.enrich("direct:enrichMovie", new ProgramMerger())
.to("direct:save")
.otherwise().to("direct:save");
// the generic save route
from("direct:save")
.setHeader("xmldb.resource.name",
vpro.xpath("//vpro:program/@id", String.class))
.process(sanitize("xmldb.resource.name"))
.to("xmldb:/programs");
// route to retrieve data from external
// rest service
from("direct:enrichMovie")
.setHeader("title",
vpro.xpath("/vpro:program/vpro:title[1]/text()", String.class))
.setHeader("director", vpro.xpath("//vpro:pers...@urn =
'urn:mpeg:mpeg7:cs:RoleCS:2001:DIRECTOR' and
1]/vpro:familyName/text()", String.class))
.setHeader("year", vpro.xpath("//vpro:year[1]/text()",
String.class))
.process(new CinemaQueryAssembler())
.to("http://cinema.test.vpro.nl/api/1/rest/movie/find.xml");
The xmldb producer is a patched version of the camel-extra project.
Everything works fine, apart from the enricher...
Any hints?
kind regards,
Peter Maas