当前位置: 首页>>代码示例>>C#>>正文


C# Message.GetMessageHops方法代码示例

本文整理汇总了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);
        }
开发者ID:gitter-badger,项目名称:kino,代码行数:26,代码来源:MultipartMessage.cs

示例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}");
            }
        }
开发者ID:gitter-badger,项目名称:kino,代码行数:16,代码来源:MessageTracer.cs

示例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());
        }
开发者ID:gitter-badger,项目名称:kino,代码行数:18,代码来源:MessageTests.cs

示例4: MessageCameFromLocalActor

 private bool MessageCameFromLocalActor(Message message)
 {
     return !message.GetMessageHops().Any();
 }
开发者ID:gitter-badger,项目名称:kino,代码行数:4,代码来源:MessageRouter.cs

示例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);
 }
开发者ID:gitter-badger,项目名称:kino,代码行数:12,代码来源:ActorHost.cs

示例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);
        }
开发者ID:gitter-badger,项目名称:kino,代码行数:9,代码来源:ActorHost.cs

示例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);
            }
        }
开发者ID:gitter-badger,项目名称:kino,代码行数:25,代码来源:ActorHost.cs


注:本文中的Message.GetMessageHops方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。