protected override void OnMessageSerializationFailure(Message msg, Exception exc) { // we only get here if we failed to serialise the msg (or any other catastrophic failure). // Request msg fails to serialise on the sending silo, so we just enqueue a rejection msg. Log.Warn(ErrorCode.ProxyClient_SerializationError, String.Format("Unexpected error serializing message to gateway {0}.", Address), exc); FailMessage(msg, String.Format("Unexpected error serializing message to gateway {0}. {1}", Address, exc)); if (msg.Direction == Message.Directions.Request || msg.Direction == Message.Directions.OneWay) { return; } // Response msg fails to serialize on the responding silo, so we try to send an error response back. // if we failed sending an original response, turn the response body into an error and reply with it. msg.Result = Message.ResponseTypes.Error; msg.BodyObject = Response.ExceptionResponse(exc); try { MsgCenter.SendMessage(msg); } catch (Exception ex) { // If we still can't serialize, drop the message on the floor Log.Warn(ErrorCode.ProxyClient_DroppingMsg, "Unable to serialize message - DROPPING " + msg, ex); msg.ReleaseBodyAndHeaderBuffers(); } }
protected override bool PrepareMessageForSend(Message msg) { if (Cts == null) { return(false); } // Check to make sure we're not stopped if (Cts.IsCancellationRequested) { // Recycle the message we've dequeued. Note that this will recycle messages that were queued up to be sent when the gateway connection is declared dead MsgCenter.SendMessage(msg); return(false); } if (msg.TargetSilo != null) { return(true); } msg.TargetSilo = Silo; if (msg.TargetGrain.IsSystemTarget) { msg.TargetActivation = ActivationId.GetSystemActivation(msg.TargetGrain, msg.TargetSilo); } return(true); }
private void RerouteMessage(Message msg) { msg.TargetActivation = null; msg.TargetSilo = null; MsgCenter.SendMessage(msg); }
protected override void OnGetSendingSocketFailure(Message msg, string error) { msg.TargetSilo = null; // clear previous destination! MsgCenter.SendMessage(msg); }
protected override void OnGetSendingSocketFailure(Message msg, string error) { MsgCenter.SendMessage(msg); }