camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vadim Chekan" <kot.bege...@gmail.com>
Subject Expression pipe
Date Sat, 30 Aug 2008 00:17:14 GMT
I'm having problem with the following expression:
		from("activemq:Integration.Status").
		setHeader("Body").el("${in.body}").
		setBody().el("${in.headers}").
		marshal().
		xstream().convertBodyTo(String.class).
		setBody().el("declare @h uniqueidentifier; "+
		           "begin dialog conversation @h "+
		           "from service StatusResponseService "+
		           "to service 'StatusService' "+
		           "with encryption=off; "+
		           "send on conversation @h ('${in.body.replace('\'','\'\'')}'); ").
		to("jdbc:Status");

The line before last returns Object so it can not be sent "to".
I'm trying to serialize a message, including all headers into xml,
than craft a sql expression which would contain this xml as a
parameter and send it to jdbc endpoint.
I spent several hors trying all possible combinations and still have
no clue how to do this double body transform.
I feel like I need to use "pipeline" pattern but I can not understand
what two elements should be inside this pipe.

So far I made it working using 2 queues but it feels wrong:
		from("activemq:Integration.Status").
		setHeader("Body").el("${in.body}").
		setBody().el("${in.headers}").
		marshal().
		xstream().convertBodyTo(String.class).
		to("activemq:Integration.Status2");
		
		from("activemq:Integration.Status2").
		setBody().el("declare @h uniqueidentifier; "+
		           "begin dialog conversation @h "+
		           "from service StatusResponseService "+
		           "to service 'StatusService' "+
		           "with encryption=off; "+
		           "send on conversation @h ('${in.body.replace('\'','\'\'')}'); ").
		to("jdbc:Status");

And another question: in "el" this fragment
"'${in.body.replace('\'','\'\'')}" gives me an error: syntax error at
position 187, encountered ',', expected ')'
How can I replace single quote in the body with two single quote chars?

Vadim.

-- 
>From RFC 2631: In ASN.1, EXPLICIT tagging is implicit unless IMPLICIT
is explicitly specified

Mime
View raw message