1

我有一个接收 MSMQ 消息并使用NEsper执行(接近)实时分析的系统。有些消息可能会迟到,并且可能以不同的顺序出现。这种情况应予以标记和报告。不要写这是它的工作方式(元代码):

//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
}

如何更好地处理消息“从过去”到达的情况,我不能抛出异常,因为我仍然需要处理消息,但我希望用户了解有关消息的更多详细信息,而不是仅仅说有N错误地接收到消息。我正在考虑做类似 AggregateException 的事情,但不确定它是如何工作的。有任何想法吗?

4

0 回答 0