camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onders <ondersezgin+camelu...@gmail.com>
Subject enrich EIP with sql component
Date Fri, 07 Jul 2017 14:16:29 GMT
Hi,

I have a route as below;

from("seda:A?concurrentConsumers=2")
     .enrich("sql:select X from test_table where id =
:#${body.getId}?outputClass="
						+ MyX.class.getName()", new AggregationStrategy() {

        @Override
	public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
		if( newExchange == null) {
			return oldExchange;
		}
		
		MyX x = newExchange.getIn().getBody(MyX.class);
		
		SimplePojo sPojo = oldExchange.getIn().getBody(SimplePojo.class);
		
		sPojo.setX(x.getX());
		
		oldExchange.getIn().setBody(sPojo);
		
		return oldExchange;
	}
                                                }).
.to("sql:update PojoTable set status = :#${body.getStatus} where id =
:#${body.getId}");


I am not sure why but during aggregation
newExchange.getIn().getBody(MyX.class) ends up with null resultset like
enrich has not run at all.

Am i missing something? Or enrich EIP does not work with sql component like
this?

Cheers





--
View this message in context: http://camel.465427.n5.nabble.com/enrich-EIP-with-sql-component-tp5806575.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message