Exemplo n.º 1
0
        protected override void Execute(CodeActivityContext context)
        {
            ContextClient contextClient = null;

            if (ContextClient.Expression == null)
            {
                var ContextClientArgument = context.DataContext.GetProperties()["ContextClient"];
                contextClient = ContextClientArgument.GetValue(context.DataContext) as ContextClient;
                if (contextClient == null)
                {
                    throw (new ArgumentException("ContextClient was not provided and cannot be retrieved from the container."));
                }
            }
            else
            {
                contextClient = ContextClient.Get(context);
            }

            var    executorRuntime = context.GetExtension <IExecutorRuntime>();
            string currentProcess;

            if (executorRuntime != null)
            {
                var jobInfo = executorRuntime.RunningJobInformation;

                currentProcess = jobInfo.ProcessName.ToString();

                if (currentProcess.Contains("_"))
                {
                    currentProcess = currentProcess.Split('_')[0];
                }
            }
            else
            {
                currentProcess = "DummyProcess";
            }

            ContextMessage aNewContextMessage = new ContextMessage();

            if (contextClient.GetNextMessage(currentProcess, ref aNewContextMessage))
            {
                this.Action.Set(context, aNewContextMessage.Action);
                this.ArgumentsJson.Set(context, aNewContextMessage.ArgumentsJson);
                this.From.Set(context, aNewContextMessage.From);
                this.TimeSent.Set(context, aNewContextMessage.DateSent);

                this.To.Set(context, currentProcess);

                this.MessageQueueEmpty.Set(context, false);
            }
            else
            {
                this.MessageQueueEmpty.Set(context, true);
            }
        }
Exemplo n.º 2
0
        protected override void Execute(CodeActivityContext context)
        {
            ContextClient contextClient = null;
            string        aValue;

            if (ContextClient.Expression == null)
            {
                var ContextClientArgument = context.DataContext.GetProperties()["ContextClient"];
                contextClient = ContextClientArgument.GetValue(context.DataContext) as ContextClient;
                if (contextClient == null)
                {
                    throw (new ArgumentException("ContextClient was not provided and cannot be retrieved from the container."));
                }
            }
            else
            {
                contextClient = ContextClient.Get(context);
            }

            aValue = contextClient.GetVariable(VariableName.Get(context), this.RaiseException);

            VariableValue.Set(context, aValue);
        }