camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fliot33 <francois.l...@poplidays.com>
Subject Aggregator, beyond the simple string example
Date Wed, 18 Dec 2013 20:13:03 GMT
Hi,

I really enjoy the pattern <enrich uri="..." strategyRef="..."/>
It's straight forward and really very reusable, really great.

Btw, beyond the StringInAggregatingStrategy documented example,
does anybody have a real life XML Aggregating Strategy example ?

Indeed, since, depending your endpoints, you do not control obviously the
encoding variables, either your body type, try to aggregate :
"""<?xml version="1.0" encoding="UTF-8"?><test1>content</test1>"""
with :
"""<?xml version="1.0" encoding="ISO-8859-1"?><test2>éèàù$ê£ë</test2>"""

to obtain :
"""<?xml version="1.0"
encoding="UTF-8"?><xml><test1>content</test1><test2>éèàù$ê£ë</test2></xml>"""
(encoded into utf-8)

This is slightly more complex than just :
    String oldBody = oldExchange.getIn().getBody(String.class);
    String newBody = newExchange.getIn().getBody(String.class);
    result = "<xml>" + oldBody + newBody + "</xml>";
    ...

I didn't get success trying to read newExchange as something else that a
"String.class", to get better Bytes level reading.

Thanks in advance for any advice.

Best regards,

Francois




--
View this message in context: http://camel.465427.n5.nabble.com/Aggregator-beyond-the-simple-string-example-tp5745012.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message