Beispiel #1
0
        public Message CreateResponseMessage()
        {
            var response = new Message(this.Category, Directions.Response)
            {
                Id                 = this.Id,
                IsReadOnly         = this.IsReadOnly,
                IsAlwaysInterleave = this.IsAlwaysInterleave,
                TargetSilo         = this.SendingSilo
            };

            if (this.ContainsHeader(Header.SENDING_GRAIN))
            {
                response.SetHeader(Header.TARGET_GRAIN, this.GetHeader(Header.SENDING_GRAIN));
                if (this.ContainsHeader(Header.SENDING_ACTIVATION))
                {
                    response.SetHeader(Header.TARGET_ACTIVATION, this.GetHeader(Header.SENDING_ACTIVATION));
                }
            }

            response.SendingSilo = this.TargetSilo;
            if (this.ContainsHeader(Header.TARGET_GRAIN))
            {
                response.SetHeader(Header.SENDING_GRAIN, this.GetHeader(Header.TARGET_GRAIN));
                if (this.ContainsHeader(Header.TARGET_ACTIVATION))
                {
                    response.SetHeader(Header.SENDING_ACTIVATION, this.GetHeader(Header.TARGET_ACTIVATION));
                }
                else if (this.TargetGrain.IsSystemTarget)
                {
                    response.SetHeader(Header.SENDING_ACTIVATION, ActivationId.GetSystemActivation(TargetGrain, TargetSilo));
                }
            }

            if (this.ContainsHeader(Header.TIMESTAMPS))
            {
                response.SetHeader(Header.TIMESTAMPS, this.GetHeader(Header.TIMESTAMPS));
            }
            if (this.ContainsHeader(Header.DEBUG_CONTEXT))
            {
                response.SetHeader(Header.DEBUG_CONTEXT, this.GetHeader(Header.DEBUG_CONTEXT));
            }
            if (this.ContainsHeader(Header.CACHE_INVALIDATION_HEADER))
            {
                response.SetHeader(Header.CACHE_INVALIDATION_HEADER, this.GetHeader(Header.CACHE_INVALIDATION_HEADER));
            }
            if (this.ContainsHeader(Header.EXPIRATION))
            {
                response.SetHeader(Header.EXPIRATION, this.GetHeader(Header.EXPIRATION));
            }
            if (Message.WriteMessagingTraces)
            {
                response.AddTimestamp(LifecycleTag.CreateResponse);
            }

            RequestContext.ExportToMessage(response);

            return(response);
        }
Beispiel #2
0
        public Message CreateResponseMessage()
        {
            var response = new Message(this.Category, Directions.Response)
            {
                Id                 = this.Id,
                IsReadOnly         = this.IsReadOnly,
                IsAlwaysInterleave = this.IsAlwaysInterleave,
                TargetSilo         = this.SendingSilo
            };

            if (this.ContainsHeader(Header.SENDING_GRAIN))
            {
                response.SetHeader(Header.TARGET_GRAIN, this.GetHeader(Header.SENDING_GRAIN));
                if (this.ContainsHeader(Header.SENDING_ACTIVATION))
                {
                    response.SetHeader(Header.TARGET_ACTIVATION, this.GetHeader(Header.SENDING_ACTIVATION));
                }
            }

            response.SendingSilo = this.TargetSilo;
            if (this.ContainsHeader(Header.TARGET_GRAIN))
            {
                response.SetHeader(Header.SENDING_GRAIN, this.GetHeader(Header.TARGET_GRAIN));
                if (this.ContainsHeader(Header.TARGET_ACTIVATION))
                {
                    response.SetHeader(Header.SENDING_ACTIVATION, this.GetHeader(Header.TARGET_ACTIVATION));
                }
                else if (this.TargetGrain.IsSystemTarget)
                {
                    response.SetHeader(Header.SENDING_ACTIVATION, ActivationId.GetSystemActivation(TargetGrain, TargetSilo));
                }
            }

            if (this.ContainsHeader(Header.DEBUG_CONTEXT))
            {
                response.SetHeader(Header.DEBUG_CONTEXT, this.GetHeader(Header.DEBUG_CONTEXT));
            }
            if (this.ContainsHeader(Header.CACHE_INVALIDATION_HEADER))
            {
                response.SetHeader(Header.CACHE_INVALIDATION_HEADER, this.GetHeader(Header.CACHE_INVALIDATION_HEADER));
            }
            if (this.ContainsHeader(Header.EXPIRATION))
            {
                response.SetHeader(Header.EXPIRATION, this.GetHeader(Header.EXPIRATION));
            }

            var contextData = RequestContext.Export();

            if (contextData != null)
            {
                response.RequestContextData = contextData;
            }
            return(response);
        }
Beispiel #3
0
        internal static Message CreateRcRequest(InvokeMethodRequest request, bool refresh)
        {
            var message = new Message(
                Categories.Application, Directions.OneWay)
            {
                Id                 = CorrelationId.GetNext(),
                BodyObject         = request,
                IsAlwaysInterleave = true
            };

            message.SetHeader(Header.RC_MSG, refresh ? ReactiveComputationTypes.KeepAlive : ReactiveComputationTypes.Execute);

            var contextData = RequestContext.Export();

            message.RequestContextData = contextData;

            return(message);
        }