Пример #1
0
        static void Main(string[] args)
        {
            RegisterWorkflowEngine();

            // for tests(MS SQL)
            //args = new string[]{
            //    "-url=http://*:8077/",
            //    //"-callbackurl=http://localhost:8078/",
            //    //"-callbackgenscheme",
            //    "-dbprovider=mssql",
            //   // "-log",
            //    "-dbcs=Data Source=(local)\\SQL2012;Initial Catalog=WFTemp;Integrated Security=True;User ID=sa;Password=1;",
            //    "-befolder=../backend"
            //};

            var wsparams = ParseWorkflowServerParameter(args);

            if (wsparams == null)
            {
                ShowAllParameters();
                return;
            }

            Console.WriteLine("WorkflowServer by OptimaJet");
            Console.WriteLine("WorkflowEngine.NET: Init...");
            var workflowserver = new OptimaJet.WorkflowServer(wsparams);

            if (!wsparams.NoStartWorkflow)
            {
                Console.WriteLine("WorkflowEngine.NET: Starting...");
                workflowserver.Start();
            }

            Console.WriteLine("WorkflowServer: Starting...");
            var subject = new Subject <string>();

            using (var server = new HttpServer(wsparams.Url))
            {
                Console.WriteLine(string.Format("Waiting for a connection on {0}...", wsparams.Url));
                var listeners = OptimaJet.ServerHelper.SubscribeProcessing(server, workflowserver);

                while (true)
                {
                    Console.WriteLine("For exit please enter 'Q'.");
                    var command = Console.ReadLine();
                    if (!string.IsNullOrEmpty(command) && command.ToUpper() == "Q")
                    {
                        break;
                    }
                }

                listeners.Dispose();
            }
        }
Пример #2
0
        protected override void OnStart(string[] args)
        {
            WorkflowServerParameter wsparams = GetParams();

            RegisterWorkflowEngine();

            Log("WorkflowEngine.NET: Init...");
            _workflowserver = new OptimaJet.WorkflowServer(wsparams);

            if (!wsparams.NoStartWorkflow)
            {
                Log("WorkflowEngine.NET: Starting...");
                _workflowserver.Start();
            }

            Log("HttpServer: Starting...");
            _server = new HttpServer(wsparams.Url);
            Log($"Waiting for a connection on {wsparams.Url}...");

            _listeners = ServerHelper.SubscribeProcessing(_server, _workflowserver);
        }