Пример #1
0
        /// <inheritdoc />
        public bool TryDispatchToClient(Message message)
        {
            if (!ClientGrainId.TryParse(message.TargetGrain, out var targetClient) || !this.ClientId.Equals(targetClient))
            {
                return(false);
            }

            if (message.IsExpired)
            {
                this.messagingTrace.OnDropExpiredMessage(message, MessagingStatisticsGroup.Phase.Receive);
                return(true);
            }

            if (message.Direction == Message.Directions.Response)
            {
                // Requests are made through the runtime client, so deliver responses to the rutnime client so that the request callback can be executed.
                this.runtimeClient.ReceiveResponse(message);
            }
            else
            {
                // Requests agrainst client objects are scheduled for execution on the client.
                this.incomingMessages.Writer.TryWrite(message);
            }

            return(true);
        }
Пример #2
0
 /// <summary>
 /// Returns the <see cref="ClientGrainId"/> associated with this instance.
 /// </summary>
 public ClientGrainId GetClientId()
 {
     if (!ClientGrainId.TryParse(this.GrainId, out var result))
     {