java - Trouble receiving multiple emails with camel aggregator -


i'm not sure how word correctly, i'll try best.

i want send n emails n recipients via camel route , have n recipients send approvals sender, done using world 'approve' in subject, @ point, i'd trigger process.

the first half of task done, sending emails relatively simple task in camel. receiving well. problem lies in fact i'd wait on these n emails received before continuing.

i'm using this code attempt latter half.

from("imaps://imap.gmail.com?username=emailaddress@gmail.com&" +  "password=raw(password)&searchterm.subject=approve") .aggregate(header("*"), new uselatestaggregationstrategy()) .completionsize(2) .process(myprocess); 

i know code won't i'm asking for, it's i'm working now. i'm getting this error when drop .jar servicemix

org.apache.camel.camelexchangeexception: invalid correlation key. exchange[mailmessage: 

i've tried looking error, haven't gotten that's helpful. it's obvious it's either header or aggregation strategy, again, have yet find useful situation.

is there better way this? feel problems coming not understanding nuances of camel, there may easier/better way achieve this. if not, missing?

i apologize if i've left useful out. feel free ask questions.

you can use constant correlation key if want message grouped together, example:

.aggregate(constant(true), new uselatestaggregationstrategy()) 

Comments