private CallerDescriptor GetCaller(IHeaderDictionary headers)
        {
            CallerDescriptor caller = null;
            var callerServiceName   = headers.GetValue(DasyncHttpHeaders.CallerServiceName);
            var callerServiceProxy  = headers.GetValue(DasyncHttpHeaders.CallerServiceProxy);

            if (!string.IsNullOrEmpty(callerServiceName))
            {
                caller = new CallerDescriptor
                {
                    IntentId = headers.GetValue(DasyncHttpHeaders.CallerIntentId),
                    Service  = new ServiceId {
                        Name = callerServiceName, Proxy = callerServiceProxy
                    }
                };

                var callerMethodName = headers.GetValue(DasyncHttpHeaders.CallerMethodName);
                if (!string.IsNullOrEmpty(callerServiceName))
                {
                    caller.Method = new MethodId {
                        Name = callerMethodName
                    };
                }

                var callerEventName = headers.GetValue(DasyncHttpHeaders.CallerEventName);
                if (!string.IsNullOrEmpty(callerEventName))
                {
                    caller.Event = new EventId {
                        Name = callerEventName
                    };
                }
            }
            return(caller);
        }
Exemple #2
0
        private void AddCallerHeaders(HttpContentHeaders headers, CallerDescriptor caller)
        {
            if (caller == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(caller.IntentId))
            {
                headers.TryAddWithoutValidation(DasyncHttpHeaders.CallerIntentId, caller.IntentId);
            }

            if (caller.Service != null)
            {
                headers.TryAddWithoutValidation(DasyncHttpHeaders.CallerServiceName, caller.Service.Name);
                if (!string.IsNullOrEmpty(caller.Service.Proxy))
                {
                    headers.TryAddWithoutValidation(DasyncHttpHeaders.CallerServiceProxy, caller.Service.Proxy);
                }
            }

            if (caller.Method != null)
            {
                headers.TryAddWithoutValidation(DasyncHttpHeaders.CallerMethodName, caller.Method.Name);
            }

            if (caller.Event != null)
            {
                headers.TryAddWithoutValidation(DasyncHttpHeaders.CallerEventName, caller.Event.Name);
            }
        }
 public TransitionCarrier(
     MethodInvocationData methodInvocationData,
     IValueContainerCopier valueContainerCopier,
     ICommunicatorMessage message)
 {
     _methodInvocationData = methodInvocationData;
     Caller = methodInvocationData.Caller;
     _valueContainerCopier = valueContainerCopier;
     Message = message;
 }
        public void OnRoutineStart(
            IServiceReference serviceRef,
            IMethodReference methodRef,
            PersistedMethodId methodId,
            object serviceInstance,
            IAsyncStateMachine routineStateMachine,
            CallerDescriptor caller)
        {
            Context.ServiceRef          = serviceRef;
            Context.MethodRef           = methodRef;
            Context.MethodId            = methodId;
            Context.ServiceInstance     = serviceInstance;
            Context.RoutineStateMachine = routineStateMachine;
            Context.Caller = caller;

            _intrinsicFlowController.OnRoutineStart(this);
        }
 public void SetMethodExecutionState(MethodExecutionState methodExecutionState, IValueContainerCopier valueContainerCopier)
 {
     _methodExecutionState = methodExecutionState;
     Caller = _methodExecutionState.Caller;
     _valueContainerCopier = valueContainerCopier;
 }