camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dermoritz <>
Subject Problem with custom aggregation/ custom correlation (data base rows)
Date Tue, 06 Oct 2015 08:52:01 GMT
I am fetching data from data base (jdbc component) that contains 1:n
relations. That means that i have multiple entries with same id:

id1,childId1, childFieldValue1, <other fields of id1>
id1,childId2, childFieldValue2, <other fields of id1>
id2,childId3, childFieldValue1, <other fields of id2>
id2,childId4, childFieldValue2, <other fields of id2>
id2,childId5, childFieldValue3, <other fields of id2>

I want to aggregate them to 

id1,[{childId1, childFieldValue1},{childId2, childFieldValue2}], <other
fields of id1>.
id2,[{childId3, childFieldValue1},{childId4, childFieldValue2}, {childId5,
childFieldValue3}], <other fields of id2>
The aggregation itself is not the problem but the correlation or completing
aggregation. My first try was to aggregate all ("constant(true)" as
correlation). With this i compared the ids of newExchange and oldExchange.
If the id is different i mark the oldExchange with special header
("complete"). The problem here is, that i have to return the oldExchange and
with this i lose the newExchange that starts a new group.
Don't know if i really need it but i thought about creating a custom
Predicate for correlation. But how?

So how would you solve this problem?

Thanks in advance

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

View raw message