I have a system that receives MSMQ messages and performs (close to) real-time analysis using NEsper. It is possible that some messages come late and perhaps in different order. This situation shall be flagged up and reported. Write not this is how it is working (meta code):
//shows how many messages came in wrong order
private int error;
//processing function
void MessageReceived(Message m)
{
//the message is from the `past`
//if compared to the engine time
if(m.Occured < currentEngineTime)
{
error++; // I think there is a beter way to do this
}
// update engine time if required
//engine time is manually adjusted with
//each newest message
//perform analysis of the message
//pass message to the engine processing pipeline
}
How do I better handle the situation where a message arrives "from the past", I cannot throw an exception as I still need the message to be processed, but I want the user to know more details about the message rather just saying that there was N incorrectly received messages. I was thinking to do something like AggregateException, but not sure how that works. Any ideas?