camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpcook <>
Subject Re: Integration Patterns inside the ActiveMQ Message Broker
Date Tue, 16 Oct 2007 15:06:01 GMT


I'm trying to do a simple xslt transformation. Here is my simple main
method. Sorry if it is difficult to read.

public static void main(String[] args) throws Exception {
		// TODO Auto-generated method stub
		CamelContext context = new DefaultCamelContext();
		ConnectionFactory connectionFactory = new
		 context.addRoutes(new RouteBuilder() {

	            public void configure() throws Exception {
	                from("test-jms:queue:test.queue").process(new Processor() {

	                    public void process(Exchange e) throws Exception {
	                    	System.out.println("Received exchange: " + e.getIn());
       		            	File styleSheet = new File("rugby_fixtures.xslt");
	                    	XsltBuilder xsltBuilder =
	                    	XsltBuilder xsltBuilder1 = xsltBuilder.outputString();
	                    	ProcessorType processorType =
	                            	System.out.println("Received exchange: " +
		 CamelTemplate template = new CamelTemplate(context);
		 File file = new File("rugbyFixturesCollated.xml");
		 XPP3Reader reader = new XPP3Reader();
		 Document rugbyFixtures =;
		 String xmlMessage = rugbyFixtures.asXML();
		 template.sendBody("test-jms:queue:test.queue", xmlMessage );

So I know the xslt works as I've tested it in a browser. The println line
outputs the message as well and I can see the complete xml.

However what I really wanted to do was to be able to see the result of the
transformation which is me playing around with the outputString method but
that just sets the output. Is there a way I can look the output for
debuggins purposes.

Also this doesn't appear to output a file. I'd expect a directory and
rugbyFixtures/ to be created but one isn't.

Apologies if this is a bit basic.


James.Strachan wrote:
> On 05/10/2007, jpcook <> wrote:
>> Doh. ignore last post.
>> URL styleSheet = getClass().getResource("/xslt/rugbyFixtures.xslt");
>> from("jms:ss.service.solrenderservice").process(XsltBuilder.xslt(styleSheet)).to("file:rugbyFixtures");
> Yeah - one of the downsides with the current DSL is often we use
> static imports to make things extensible; so the use of xslt in that
> one was probably a static import you saw. We should try and remove
> those and add things like xpath, xslt and the like to the DSL so that
> IDEs properly smart complete etc.
>> What I would like to be able to do is. read in a message from my jms. 
>> Then
>> get one of the xml attributes from the message to lookup the location of
>> where I want to send the output.
>> I think it is that recipientList pattern. Would that be possible?
> Yeah - you could either do a content based router using XPath
> predicates, or use an XPath expression to determine the URL to send
> to.
> e.g.
> from("activemq:myQueue").recipientList(xpath("'activemq:my.' +
> /foo/bar"));
> i.e. using an XPath expression to determine the URI to send the message
> to.
>> Finally I'm not quite sure what I should be doing with exceptions. Just
>> logging them, and which log will they appear in?
> There's an error handler plugin you can use to customize what to do
> with exceptions and errors...
> so for example you can use a dead letter channel to retry on
> exceptions until some number of times and then log it to some queue or
> log.
> -- 
> James
> -------
> Open Source SOA

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message