I'm truly not sure how to word this correctly, but I'll try my best.
I want to send n emails to n recipients via a camel route and have those n recipients send approvals to the sender, which is done by using the world 'approve' in the subject, at which point, I'd trigger a process.
The first half of this task is done, as sending emails is a relatively simple task in Camel. Receiving is as well. My problem lies in the fact that I'd like to wait on these n emails to be received before continuing.
I'm using this code to attempt to do the 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 this code won't do exactly what I'm asking for, but it's what I'm working with for now. I'm getting this error when I drop the .jar into ServiceMix
org.apache.camel.CamelExchangeException: Invalid correlation key. Exchange[MailMessage:
I've tried looking up the error, but I haven't gotten much that's helpful. It's fairly obvious it's from either the header or the aggregation strategy, but again, I have yet to find anything useful for my situation.
Is there a better way to do this? I feel like my problems are coming from not completely understanding the nuances of camel, so there may very well be an easier/better way to achieve this. If not, what am I missing?
I apologize if I've left anything useful out. Feel free to ask questions.
You can use a constant as the correlation key if you want any message to be grouped together, for example:
.aggregate(constant(true), new UseLatestAggregationStrategy())