本文整理汇总了C#中Message.GetMessageHops方法的典型用法代码示例。如果您正苦于以下问题:C# Message.GetMessageHops方法的具体用法?C# Message.GetMessageHops怎么用?C# Message.GetMessageHops使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message.GetMessageHops方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildMessageParts
private IEnumerable<byte[]> BuildMessageParts(Message message)
{
yield return GetSocketIdentity(message);
yield return EmptyFrame;
foreach (var hop in message.GetMessageHops())
{
yield return hop.Uri.ToSocketAddress().GetBytes();
yield return hop.Identity;
}
yield return EmptyFrame;
yield return GetTraceOptionsFrame(message);
yield return GetVersionFrame(message);
yield return GetMessageIdentityFrame(message);
yield return GetReceiverIdentityFrame(message);
yield return GetDistributionFrame(message);
yield return GetCorrelationIdFrame(message);
yield return GetCallbackIdentityFrame(message);
yield return GetCallbackReceiverIdentityFrame(message);
yield return GetTTLFrame(message);
yield return EmptyFrame;
yield return GetMessageBodyFrame(message);
}
示例2: ReceivedFromOtherNode
public void ReceivedFromOtherNode(Message message)
{
if (message.TraceOptions.HasFlag(MessageTraceOptions.Routing))
{
var hops = string.Join("|",
message
.GetMessageHops()
.Select(h => $"{nameof(h.Uri)}:{h.Uri.ToSocketAddress()}/{h.Identity.GetString()}"));
logger.Trace("Message: " +
$"{nameof(message.Version)}:{message.Version.GetString()} " +
$"{nameof(message.Identity)}:{message.Identity.GetString()} " +
$"{nameof(message.Distribution)}:{message.Distribution} " +
$"received from other node via hops {hops}");
}
}
示例3: TestMessageHops_AreConsistentlyTransferredViaMultipartMessage
public void TestMessageHops_AreConsistentlyTransferredViaMultipartMessage()
{
var message = (Message) Message.CreateFlowStartMessage(new SimpleMessage(), SimpleMessage.MessageIdentity);
var socketEnpoints = new[]
{
new SocketEndpoint(new Uri("tcp://localhost:40"), Guid.NewGuid().ToByteArray()),
new SocketEndpoint(new Uri("tcp://localhost:40"), Guid.NewGuid().ToByteArray())
};
foreach (var socketEndpoint in socketEnpoints)
{
message.PushRouterAddress(socketEndpoint);
}
var multipart = new MultipartMessage(message);
message = new Message(multipart);
CollectionAssert.AreEqual(socketEnpoints, message.GetMessageHops());
}
示例4: MessageCameFromLocalActor
private bool MessageCameFromLocalActor(Message message)
{
return !message.GetMessageHops().Any();
}
示例5: EnqueueTaskForCompletion
private void EnqueueTaskForCompletion(CancellationToken token, Task<IActorResult> task, Message messageIn)
{
var asyncMessageContext = new AsyncMessageContext
{
OutMessages = CreateTaskResultMessage(task).Messages,
CallbackIdentity = GetTaskCallbackIdentity(task, messageIn),
CallbackReceiverIdentity = messageIn.CallbackReceiverIdentity,
CorrelationId = messageIn.CorrelationId,
MessageHops = messageIn.GetMessageHops()
};
asyncQueue.Enqueue(asyncMessageContext, token);
}
示例6: CallbackException
private static void CallbackException(ISocket localSocket, Exception err, Message messageIn)
{
var messageOut = (Message) Message.Create(new ExceptionMessage {Exception = err}, ExceptionMessage.MessageIdentity);
messageOut.RegisterCallbackPoint(ExceptionMessage.MessageIdentity, messageIn.CallbackReceiverIdentity);
messageOut.SetCorrelationId(messageIn.CorrelationId);
messageOut.CopyMessageHops(messageIn.GetMessageHops());
localSocket.SendMessage(messageOut);
}
示例7: HandleTaskResult
private void HandleTaskResult(CancellationToken token, Task<IActorResult> task, Message messageIn, ISocket localSocket)
{
if (task.IsCompleted)
{
var response = CreateTaskResultMessage(task).Messages;
messageTracer.MessageProcessed(messageIn, response.Count());
foreach (var messageOut in response.Cast<Message>())
{
messageOut.RegisterCallbackPoint(GetTaskCallbackIdentity(task, messageIn), messageIn.CallbackReceiverIdentity);
messageOut.SetCorrelationId(messageIn.CorrelationId);
messageOut.CopyMessageHops(messageIn.GetMessageHops());
localSocket.SendMessage(messageOut);
messageTracer.ResponseSent(messageOut, true);
}
}
else
{
task.ContinueWith(completed => SafeExecute(() => EnqueueTaskForCompletion(token, completed, messageIn)), token)
.ConfigureAwait(false);
}
}