public Message CreateMessage(InvokeMethodRequest request, InvokeMethodOptions options) { var message = new Message { Category = Message.Categories.Application, Direction = (options & InvokeMethodOptions.OneWay) != 0 ? Message.Directions.OneWay : Message.Directions.Request, Id = CorrelationId.GetNext(), IsReadOnly = (options & InvokeMethodOptions.ReadOnly) != 0, IsUnordered = (options & InvokeMethodOptions.Unordered) != 0, IsAlwaysInterleave = (options & InvokeMethodOptions.AlwaysInterleave) != 0, BodyObject = request, IsUsingInterfaceVersions = request.InterfaceVersion > 0, RequestContextData = RequestContextExtensions.Export(this.serializationManager) }; if (options.IsTransactional()) { SetTransaction(message, options); } else { // clear transaction info if not in transaction message.RequestContextData?.Remove(TransactionContext.Orleans_TransactionContext_Key); } return(message); }
public Message CreateMessage(InvokeMethodRequest request, InvokeMethodOptions options) { var direction = (options & InvokeMethodOptions.OneWay) != 0 ? Message.Directions.OneWay : Message.Directions.Request; var message = new Message { Category = Message.Categories.Application, Direction = direction, Id = CorrelationId.GetNext(), IsReadOnly = (options & InvokeMethodOptions.ReadOnly) != 0, IsUnordered = (options & InvokeMethodOptions.Unordered) != 0, IsTransactionRequired = (options & InvokeMethodOptions.TransactionRequiresNew) != 0 || (options & InvokeMethodOptions.TransactionRequired) != 0, BodyObject = request, IsUsingInterfaceVersions = request.InterfaceVersion > 0, }; ITransactionInfo transactionInfo = message.IsTransactionRequired ? TransactionContext.GetTransactionInfo() : null; if (transactionInfo != null) { message.TransactionInfo = transactionInfo.Fork(); } if ((options & InvokeMethodOptions.AlwaysInterleave) != 0) { message.IsAlwaysInterleave = true; } message.RequestContextData = RequestContextExtensions.Export(this.serializationManager); return(message); }
public Message CreateResponseMessage(Message request) { var response = new Message { Category = request.Category, Direction = Message.Directions.Response, Id = request.Id, IsReadOnly = request.IsReadOnly, IsAlwaysInterleave = request.IsAlwaysInterleave, TargetSilo = request.SendingSilo, TraceContext = request.TraceContext, TransactionInfo = request.TransactionInfo }; if (request.SendingGrain != null) { response.TargetGrain = request.SendingGrain; if (request.SendingActivation != null) { response.TargetActivation = request.SendingActivation; } } response.SendingSilo = request.TargetSilo; if (request.TargetGrain != null) { response.SendingGrain = request.TargetGrain; if (request.TargetActivation != null) { response.SendingActivation = request.TargetActivation; } else if (request.TargetGrain.IsSystemTarget) { response.SendingActivation = ActivationId.GetSystemActivation(request.TargetGrain, request.TargetSilo); } } if (request.DebugContext != null) { response.DebugContext = request.DebugContext; } response.CacheInvalidationHeader = request.CacheInvalidationHeader; response.TimeToLive = request.TimeToLive; var contextData = RequestContextExtensions.Export(this.serializationManager); if (contextData != null) { response.RequestContextData = contextData; } messagingTrace.OnCreateMessage(response); return(response); }
public Message CreateResponseMessage(Message request) { var response = new Message { Category = request.Category, Direction = Message.Directions.Response, Id = request.Id, IsReadOnly = request.IsReadOnly, IsAlwaysInterleave = request.IsAlwaysInterleave, TargetSilo = request.SendingSilo, CallChainId = request.CallChainId, }; if (!request.SendingGrain.IsDefault) { response.TargetGrain = request.SendingGrain; if (!request.SendingActivation.IsDefault) { response.TargetActivation = request.SendingActivation; } } response.SendingSilo = request.TargetSilo; if (!request.TargetGrain.IsDefault) { response.SendingGrain = request.TargetGrain; if (!request.TargetActivation.IsDefault) { response.SendingActivation = request.TargetActivation; } else if (request.TargetGrain.IsSystemTarget()) { response.SendingActivation = ActivationId.GetDeterministic(request.TargetGrain); } } response.CacheInvalidationHeader = request.CacheInvalidationHeader; response.TimeToLive = request.TimeToLive; var contextData = RequestContextExtensions.Export(this.deepCopier); if (contextData != null) { response.RequestContextData = contextData; } messagingTrace.OnCreateMessage(response); return(response); }
public Message CreateMessage(object body, InvokeMethodOptions options) { var message = new Message { Category = Message.Categories.Application, Direction = (options & InvokeMethodOptions.OneWay) != 0 ? Message.Directions.OneWay : Message.Directions.Request, Id = CorrelationId.GetNext(), IsReadOnly = (options & InvokeMethodOptions.ReadOnly) != 0, IsUnordered = (options & InvokeMethodOptions.Unordered) != 0, IsAlwaysInterleave = (options & InvokeMethodOptions.AlwaysInterleave) != 0, BodyObject = body, RequestContextData = RequestContextExtensions.Export(this.deepCopier) }; messagingTrace.OnCreateMessage(message); return(message); }