Ejemplo n.º 1
0
            public void Execute(ProcessNode currentNode, ProcessNode previousNode)
            {
                string endpoint = "tcp://127.0.0.1:5556";

                // Create
                using (var context = new ZContext())
                    using (var requester = new ZSocket(context, ZSocketType.REQ))
                    {
                        // Connect
                        requester.Connect(endpoint);

                        string requestText = "Do some work";
                        Console.WriteLine("Request {0}", requestText);

                        // Send
                        requester.Send(new ZFrame(requestText));

                        // Receive
                        using (ZFrame reply = requester.ReceiveFrame())
                        {
                            Console.WriteLine("Received: {0} ", reply.ReadString());
                        }

                        currentNode.Done();
                    }
            }
Ejemplo n.º 2
0
        void INodeHandler.Execute(ProcessNode processNode, ProcessNode previousNode)
        {
            Console.WriteLine(processNode.NodeName + " Executing Sequence");
            bool result = true;

            if (processNode.Expression != null)
            {
                Console.WriteLine(processNode.NodeName + " Conditional Sequence");
                Console.WriteLine("Condition: " + processNode.Expression);
                var globals = new Globals(processNode.InputParameters.ToDictionary(e => e.Key, e => e.Value));
                try
                {
                    result = CSharpScript.EvaluateAsync <bool>(processNode.Expression, globals: globals).Result;
                    Console.WriteLine("Condition result: " + result.ToString());
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }

            if (result)
            {
                processNode.Done();
            }
        }
 void INodeHandler.Execute(ProcessNode processNode, ProcessNode previousNode)
 {
     Console.WriteLine(processNode.NodeName);
     sequenceWait.GetOrAdd(processNode, new List <ProcessNode>(processNode.PreviousNodes));
     lock (sequenceWait[processNode])
     {
         sequenceWait[processNode].Remove(previousNode);
     }
     if (sequenceWait[processNode].Count == 0)
     {
         processNode.Done();
     }
 }
Ejemplo n.º 4
0
        void INodeHandler.Execute(ProcessNode processNode, ProcessNode previousNode)
        {
            Console.WriteLine(processNode.NodeName + " Executing Script");

            if (processNode.Expression != null)
            {
                Console.WriteLine("Script: " + processNode.Expression);
                var globals = new Globals(processNode.InputParameters.ToDictionary(e => e.Key, e => e.Value));
                try
                {
                    processNode.OutputParameters =
                        CSharpScript.EvaluateAsync <IDictionary <string, object> >(processNode.Expression, globals: globals)
                        .Result.ToImmutableDictionary();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
            processNode.Done();
        }
Ejemplo n.º 5
0
            public void Execute(ProcessNode currentNode, ProcessNode previousNode)
            {
                string endpoint = "tcp://127.0.0.1:5555";

                // Create
                using (var context = new ZContext())
                    using (var requester = new ZSocket(context, ZSocketType.REQ))
                    {
                        // Connect
                        requester.Connect(endpoint);

                        string requestText;
                        //testing for NodeName because retrieving node variables is not yet implemented.
                        if (currentNode.InputParameters.ContainsKey("Task2BPMN") && currentNode.NodeName == "Task_2")
                        {
                            requestText = (string)currentNode.InputParameters["Task2BPMN"];
                            Console.WriteLine("Request {0}", "Remote BPMN start");
                        }
                        else
                        {
                            requestText = "Do some work";
                            Console.WriteLine("Request {0}", requestText);
                        }


                        // Send
                        requester.Send(new ZFrame(requestText));

                        // Receive
                        using (ZFrame reply = requester.ReceiveFrame())
                        {
                            Console.WriteLine("Received: {0} ", reply.ReadString());
                        }

                        currentNode.Done();
                    }
            }
Ejemplo n.º 6
0
 void INodeHandler.Execute(ProcessNode processNode, ProcessNode previousNode)
 {
     Console.WriteLine(processNode.NodeName + " Executing End");
     processNode.ProcessInstance.SetOutputParameters(processNode);
     processNode.Done();
 }
Ejemplo n.º 7
0
 void INodeHandler.Execute(ProcessNode processNode, ProcessNode previousNode)
 {
     Console.WriteLine(processNode.NodeName + " Executing BusinessRule");
     processNode.Done();
 }
Ejemplo n.º 8
0
 public void Execute(ProcessNode processNode, ProcessNode previousNode)
 {
     Console.WriteLine(processNode.NodeName + " Executing Task");
     processNode.Done();
 }
Ejemplo n.º 9
0
 public void Execute(ProcessNode currentNode, ProcessNode previousNode)
 {
     Console.WriteLine("Custom Task Handler");
     Console.WriteLine(currentNode.NodeName);
     currentNode.Done();
 }
Ejemplo n.º 10
0
 public void Execute(ProcessNode currentNode, ProcessNode previousNode)
 {
     Responder.Send(new ZFrame("Work Done"));
     currentNode.Done();
 }
Ejemplo n.º 11
0
 void INodeHandler.Execute(ProcessNode processNode, ProcessNode previousNode)
 {
     Console.WriteLine(processNode.NodeName);
     processNode.Done();
 }
Ejemplo n.º 12
0
 public void Execute(ProcessNode currentNode, ProcessNode previousNode)
 {
     Console.WriteLine("*** Custom Start Handler");
     Console.WriteLine("*** " + currentNode.NodeName);
     currentNode.Done();
 }