Esempio n. 1
0
 public void SendResponse(Message message)
 {
     if (this.IsEnabled())
     {
         using (message.SetThreadActivityId())
         {
             this.SendResponse();
         }
     }
 }
Esempio n. 2
0
 public void DoCallback(Message message)
 {
     if (this.IsEnabled())
     {
         using (message.SetThreadActivityId())
         {
             this.DoCallback();
         }
     }
 }
Esempio n. 3
0
 public void OnTargetSiloFail(Message message)
 {
     if (this.IsEnabled())
     {
         using (message.SetThreadActivityId())
         {
             this.OnTargetSiloFail();
         }
     }
 }
Esempio n. 4
0
 public void ReceiveMessage(Message message)
 {
     if (this.IsEnabled())
     {
         using (message.SetThreadActivityId())
         {
             this.ReceiveMessage();
         }
     }
 }
Esempio n. 5
0
 public void OnTimeout(Message message)
 {
     if (this.IsEnabled())
     {
         using (message.SetThreadActivityId())
         {
             this.OnTimeout();
         }
     }
 }
Esempio n. 6
0
        public void ReceiveResponse(Message message)
        {
            OrleansInsideRuntimeClientEvent.Log.ReceiveResponse(message);
            if (message.Result == Message.ResponseTypes.Rejection)
            {
                if (!message.TargetSilo.Matches(this.MySilo))
                {
                    // gatewayed message - gateway back to sender
                    if (logger.IsEnabled(LogLevel.Trace))
                    {
                        this.logger.Trace(ErrorCode.Dispatcher_NoCallbackForRejectionResp, "No callback for rejection response message: {0}", message);
                    }
                    this.Dispatcher.SendMessage(message).Ignore();
                    return;
                }

                if (logger.IsEnabled(LogLevel.Debug))
                {
                    this.logger.Debug(ErrorCode.Dispatcher_HandleMsg, "HandleMessage {0}", message);
                }
                switch (message.RejectionType)
                {
                case Message.RejectionTypes.DuplicateRequest:
                    // try to remove from callbackData, just in case it is still there.
                    break;

                case Message.RejectionTypes.Overloaded:
                    break;

                case Message.RejectionTypes.Unrecoverable:
                // fall through & reroute
                case Message.RejectionTypes.Transient:
                    if (message.CacheInvalidationHeader == null)
                    {
                        // Remove from local directory cache. Note that SendingGrain is the original target, since message is the rejection response.
                        // If CacheMgmtHeader is present, we already did this. Otherwise, we left this code for backward compatability.
                        // It should be retired as we move to use CacheMgmtHeader in all relevant places.
                        this.Directory.InvalidateCacheEntry(message.SendingAddress);
                    }
                    break;

                case Message.RejectionTypes.CacheInvalidation when message.HasCacheInvalidationHeader:
                    // The message targeted an invalid (eg, defunct) activation and this response serves only to invalidate this silo's activation cache.
                    return;

                default:
                    this.logger.Error(ErrorCode.Dispatcher_InvalidEnum_RejectionType,
                                      "Missing enum in switch: " + message.RejectionType);
                    break;
                }
            }
            else if (message.Result == Message.ResponseTypes.Status)
            {
                var status = (StatusResponse)message.BodyObject;
                callbacks.TryGetValue(message.Id, out var callback);
                var request = callback?.Message;
                if (!(request is null))
                {
                    callback.OnStatusUpdate(status);
                    if (status.Diagnostics != null && status.Diagnostics.Count > 0 && logger.IsEnabled(LogLevel.Information))
                    {
                        var diagnosticsString = string.Join("\n", status.Diagnostics);
                        using (request.SetThreadActivityId())
                        {
                            this.logger.LogInformation("Received status update for pending request, Request: {RequestMessage}. Status: {Diagnostics}", request, diagnosticsString);
                        }
                    }
                }
                else
                {
                    if (status.Diagnostics != null && status.Diagnostics.Count > 0 && logger.IsEnabled(LogLevel.Information))
                    {
                        var diagnosticsString = string.Join("\n", status.Diagnostics);
                        using (message.SetThreadActivityId())
                        {
                            this.logger.LogInformation("Received status update for unknown request. Message: {StatusMessage}. Status: {Diagnostics}", message, diagnosticsString);
                        }
                    }
                }

                return;
            }