本文整理汇总了C#中IMessageContext.OnMessageHandled方法的典型用法代码示例。如果您正苦于以下问题:C# IMessageContext.OnMessageHandled方法的具体用法?C# IMessageContext.OnMessageHandled怎么用?C# IMessageContext.OnMessageHandled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMessageContext
的用法示例。
在下文中一共展示了IMessageContext.OnMessageHandled方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Handle
public void Handle(QueueMessage message, IMessageContext context)
{
var count = Interlocked.Increment(ref _handledCount);
if (count % 1000 == 0)
{
Console.WriteLine("Total handled {0} messages.", count);
}
context.OnMessageHandled(message);
}
示例2: Handle
public void Handle(QueueMessage message, IMessageContext context)
{
var count = Interlocked.Increment(ref _handledCount);
if (count == 1)
{
_watch = Stopwatch.StartNew();
}
else if (count % 1000 == 0)
{
_logger.InfoFormat("Total handled {0} messages, time spent:{1}", count, _watch.ElapsedMilliseconds);
}
context.OnMessageHandled(message);
}
示例3: Handle
public void Handle(QueueMessage message, IMessageContext context)
{
Interlocked.Increment(ref _handledCount);
Thread.Sleep(20);
context.OnMessageHandled(message);
}
示例4: Handle
public void Handle(QueueMessage message, IMessageContext context)
{
var currentCount = Interlocked.Increment(ref _handledCount);
if (currentCount == 1)
{
_watch = Stopwatch.StartNew();
}
if (currentCount % 10000 == 0)
{
_logger.InfoFormat("Total handled {0} messages, timeSpent: {1}ms, throughput: {2}/s", currentCount, _watch.ElapsedMilliseconds, currentCount * 1000 / _watch.ElapsedMilliseconds);
}
context.OnMessageHandled(message);
}
示例5: Handle
public void Handle(QueueMessage message, IMessageContext context)
{
Interlocked.Increment(ref _handledCount);
_rtStatisticService.AddRT((DateTime.Now - message.CreatedTime).TotalMilliseconds);
context.OnMessageHandled(message);
}
示例6: Handle
public void Handle(QueueMessage message, IMessageContext context)
{
var currentCount = Interlocked.Increment(ref _handledCount);
if (currentCount == 1)
{
_watch = Stopwatch.StartNew();
}
if (currentCount % 10000 == 0)
{
var currentElapsedMilliseconds = _watch.ElapsedMilliseconds;
_logger.InfoFormat("Total handled {0} messages, throughput: {1}, latency: {2}ms",
currentCount,
(currentCount - _previousHandledCount) * 1000 / (currentElapsedMilliseconds - _previousElapsedMilliseconds),
(DateTime.Now - message.CreatedTime).TotalMilliseconds);
_previousHandledCount = currentCount;
_previousElapsedMilliseconds = currentElapsedMilliseconds;
}
context.OnMessageHandled(message);
}
示例7: typeof
void IMessageHandler.Handle(QueueMessage message, IMessageContext context)
{
_processor._domainEventHandledMessageLocalQueue.Add(_processor._binarySerializer.Deserialize(message.Body, typeof(DomainEventHandledMessage)) as DomainEventHandledMessage);
context.OnMessageHandled(message);
}