本文整理汇总了C#中NetMQMessage.PopDateTime方法的典型用法代码示例。如果您正苦于以下问题:C# NetMQMessage.PopDateTime方法的具体用法?C# NetMQMessage.PopDateTime怎么用?C# NetMQMessage.PopDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetMQMessage
的用法示例。
在下文中一共展示了NetMQMessage.PopDateTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getCommit
private CommitForStorage getCommit(NetMQMessage message)
{
var context = message.Pop().ConvertToString();
var stream = message.Pop().ConvertToString();
var expectedVersion = message.PopInt64();
var eventCount = message.PopInt32();
var events = new EventForStorage[eventCount];
for (int i = 0; i < eventCount; i++)
{
var eventId = new Guid(message.Pop().ToByteArray());
var timestamp = message.PopDateTime();
var typeKey = message.PopString();
var headers = message.PopStringOrNull();
var body = message.PopString();
//-1 to override concurrency check. Being lazy and not using a constant.
var version = expectedVersion == -1 ? -1 : expectedVersion + i;
events[i] = new EventForStorage(eventId, version, timestamp, typeKey, headers, body);
}
return new CommitForStorage(context, stream, events);
}
示例2: Handle
public void Handle(NetMQFrame[] sender, NetMQMessage message)
{
Logger.Debug("[Queue_SubscribeHandler] Received subscribe request.");
var requestId = message.Pop();
var context = message.Pop().ConvertToString();
var queueId = message.Pop().ConvertToString();
var subscriberId = message.Pop().ConvertToString();
var filter = message.Pop().ConvertToString();
var utcStartTime = message.PopDateTime();
var allocationSize = message.PopInt32();
var allocationTimeInMilliseconds = message.PopInt32();
var subscribe = new SubscribeToQueue(context,
queueId,
subscriberId,
filter,
utcStartTime, allocationSize, allocationTimeInMilliseconds);
var queuedEvents = _storage.Subscribe(subscribe);
var events = queuedEvents.Events;
var msg = new NetMQMessage();
msg.Append(sender);
msg.AppendEmptyFrame();
msg.Append(ResProtocol.ResClient01);
msg.Append(requestId);
msg.Append(ResCommands.QueuedEvents);
msg.Append(context);
msg.Append(queueId);
msg.Append(subscriberId);
msg.Append(DateTime.UtcNow.ToNetMqFrame());
msg.Append(queuedEvents.AllocationId.ToNetMqFrame());
var count = events.Length;
msg.Append(count.ToNetMqFrame());
foreach (var e in events)
{
msg.Append(e.EventId.ToByteArray());
msg.Append(e.Stream);
msg.Append(e.Context);
msg.Append(e.Sequence.ToNetMqFrame());
msg.Append(e.Timestamp.ToNetMqFrame());
msg.Append(e.TypeKey);
msg.Append(e.Headers.ToNetMqFrame());
msg.Append(e.Body);
}
var result = new QueuedMessagesFetched(msg);
while (!_outBuffer.Offer(result))
_spin.SpinOnce();
}