예제 #1
0
        private void Start_(string connectionString, string applicationName) {
            var serverApplication = new ServerApplication();
            //            moduleBases.Each(@base => serverApplication.Modules.Add(@base));
            serverApplication.ApplicationName = applicationName;
            serverApplication.ConnectionString = connectionString;
            Type securityType = typeof(SecurityComplex).MakeGenericType(new[] { SecuritySystem.UserType, ((ISecurityComplex)SecuritySystem.Instance).RoleType });
            serverApplication.Security = (ISecurity)Activator.CreateInstance(securityType, new WorkflowServerAuthentication(new BinaryOperator("UserName", "WorkflowService")));
            //            serverApplication.Security = new SecurityComplex<User, Role>(
            //                new WorkflowServerAuthentication(new BinaryOperator("UserName", "WorkflowService")));
            serverApplication.Setup();
            serverApplication.Logon();

            IObjectSpaceProvider objectSpaceProvider = serverApplication.ObjectSpaceProvider;

            server = new XpandWorkflowServer(ConfigurationManager.AppSettings["WorkflowServerUrl"], objectSpaceProvider, objectSpaceProvider);
            server.CustomizeHost += delegate(object sender, CustomizeHostEventArgs e) {
                e.WorkflowInstanceStoreBehavior.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(2);
            };
            //            server.WorkflowDefinitionProvider = new WorkflowVersionedDefinitionProvider<XpoWorkflowDefinition, XpoUserActivityVersion>(objectSpaceProvider, null);
            server.WorkflowDefinitionProvider = new XpandWorkflowDefinitionProvider(typeof(XpoWorkflowDefinition), new List<Type> { typeof(ScheduledWorkflow), typeof(ObjectChangedWorkflow) });
            server.StartWorkflowListenerService.DelayPeriod = TimeSpan.FromSeconds(5);
            server.StartWorkflowByRequestService.RequestsDetectionPeriod = TimeSpan.FromSeconds(5);
            server.RefreshWorkflowDefinitionsService.DelayPeriod = TimeSpan.FromSeconds(30);

            server.Start();
            server.CustomHandleException += delegate(object sender, DevExpress.ExpressApp.Workflow.ServiceModel.CustomHandleServiceExceptionEventArgs e) {
                Tracing.Tracer.LogError(e.Exception);
                if (OnCustomHandleException_ != null) {
                    OnCustomHandleException_(this, new ExceptionEventArgs("Exception occurs:\r\n\r\n" + e.Exception.Message + "\r\n\r\n'" + e.Service.GetType() + "' service"));
                }
                e.Handled = true;
            };
        }
예제 #2
0
    public static void WebStart(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime lifetime)
    {
        SignumServer.Start(app, env, typeof(Startup).Assembly);

        AuthServer.Start(app, () => Starter.Configuration.Value.AuthTokens, "IMPORTANT SECRET FROM Southwind. CHANGE THIS STRING!!!");
        CacheServer.Start(app);
        FilesServer.Start(app);
        UserQueryServer.Start(app);
        DashboardServer.Start(app);
        WordServer.Start(app);
        ExcelServer.Start(app);
        ChartServer.Start(app);
        MapServer.Start(app);
        ToolbarServer.Start(app);
        TranslationServer.Start(app,
                                new AlreadyTranslatedTranslator(),
                                new AzureTranslator(
                                    () => Starter.Configuration.Value.Translation.AzureCognitiveServicesAPIKey,
                                    () => Starter.Configuration.Value.Translation.AzureCognitiveServicesRegion),
                                new DeepLTranslator(() => Starter.Configuration.Value.Translation.DeepLAPIKey)
                                ); //TranslationServer
        SchedulerServer.Start(app, lifetime);
        ProcessServer.Start(app);
        MailingServer.Start(app);
        ProfilerServer.Start(app);
        DiffLogServer.Start(app);
        RestServer.Start(app);
        RestLogServer.Start(app);
        PredictorServer.Start(app);
        WorkflowServer.Start(app);
        AlertsServer.Start(app);
        DynamicServer.Start(app);

        OmniboxServer.Start(app,
                            new EntityOmniboxResultGenenerator(),
                            new DynamicQueryOmniboxResultGenerator(),
                            new ChartOmniboxResultGenerator(),
                            new DashboardOmniboxResultGenerator(DashboardLogic.Autocomplete),
                            new UserQueryOmniboxResultGenerator(UserQueryLogic.Autocomplete),
                            new UserChartOmniboxResultGenerator(UserChartLogic.Autocomplete),
                            new MapOmniboxResultGenerator(type => OperationLogic.TypeOperations(type).Any()),
                            new ReactSpecialOmniboxGenerator()
                               //new HelpModuleOmniboxResultGenerator(),
                            ); //Omnibox

        ReflectionServer.RegisterLike(typeof(RegisterUserModel), () => true);

        SignumCultureSelectorFilter.GetCurrentCulture = (ctx) => GetCulture(ctx);
    }
예제 #3
0
        private void Start_(string connectionString, string applicationName)
        {
            ServerApplication serverApplication = new ServerApplication();

            serverApplication.ApplicationName = applicationName;
            serverApplication.Modules.Add(new WorkflowDemoEFModule());
            serverApplication.ConnectionString = connectionString;
            WorkflowModule workflowModule = serverApplication.Modules.FindModule <WorkflowModule>();

            serverApplication.Setup();
            serverApplication.Logon();

            IObjectSpaceProvider objectSpaceProvider = serverApplication.ObjectSpaceProvider;

            server = new WorkflowServer("http://localhost:46232", objectSpaceProvider, objectSpaceProvider);
            server.StartWorkflowListenerService.DelayPeriod      = TimeSpan.FromSeconds(10);
            server.StartWorkflowByRequestService.DelayPeriod     = TimeSpan.FromSeconds(10);
            server.RefreshWorkflowDefinitionsService.DelayPeriod = TimeSpan.FromSeconds(15);
            server.CustomizeHost += delegate(object sender, CustomizeHostEventArgs e) {
                //    // NOTE: Uncomment this section to use alternative workflow configuration.
                //    //
                //    // SqlWorkflowInstanceStoreBehavior
                //    //
                //    //e.WorkflowInstanceStoreBehavior = null;
                //    //System.ServiceModel.Activities.Description.SqlWorkflowInstanceStoreBehavior sqlWorkflowInstanceStoreBehavior = new System.ServiceModel.Activities.Description.SqlWorkflowInstanceStoreBehavior("Integrated Security=SSPI;Pooling=false;Data Source=(local);Initial Catalog=WorkflowsStore");
                //    //sqlWorkflowInstanceStoreBehavior.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(2);
                //    //e.Host.Description.Behaviors.Add(sqlWorkflowInstanceStoreBehavior);
                //e.WorkflowIdleBehavior.TimeToPersist = TimeSpan.FromSeconds(10);
                e.WorkflowIdleBehavior.TimeToUnload = TimeSpan.FromSeconds(10);
                e.WorkflowInstanceStoreBehavior.WorkflowInstanceStore.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(1);
            };

            server.CustomHandleException += delegate(object sender, CustomHandleServiceExceptionEventArgs e) {
                Tracing.Tracer.LogError(e.Exception);
                if (OnCustomHandleException_ != null)
                {
                    OnCustomHandleException_(this, new ExceptionEventArgs("Exception occurs:\r\n\r\n" + e.Exception.Message + "\r\n\r\n'" + e.Service.GetType().FullName + "' service"));
                }
                e.Handled = true;
            };
            server.Start();
        }
        protected override void OnStart(string[] args)
        {
            if (server == null)
            {
                ServerApplication serverApplication = new ServerApplication();
                serverApplication.ApplicationName        = "WKLearn";
                serverApplication.CheckCompatibilityType = CheckCompatibilityType.DatabaseSchema;
                // The service can only manage workflows for those business classes that are contained in Modules specified by the serverApplication.Modules collection.
                // So, do not forget to add the required Modules to this collection via the serverApplication.Modules.Add method.
                serverApplication.Modules.BeginInit();
                serverApplication.Modules.Add(new WorkflowModule());
                serverApplication.Modules.Add(new WKLearn.Module.WKLearnModule());
                serverApplication.Modules.Add(new WKLearn.Module.Win.WKLearnWindowsFormsModule());
                serverApplication.Modules.Add(new WKLearn.Module.Web.WKLearnAspNetModule());
                if (ConfigurationManager.ConnectionStrings["ConnectionString"] != null)
                {
                    serverApplication.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
                }
                serverApplication.Setup();
                serverApplication.Logon();

                IObjectSpaceProvider objectSpaceProvider = serverApplication.ObjectSpaceProvider;

                WorkflowCreationKnownTypesProvider.AddKnownType(typeof(DevExpress.Xpo.Helpers.IdList));

                server = new WorkflowServer("http://localhost:46232", new BasicHttpBinding(), objectSpaceProvider, objectSpaceProvider);
                server.StartWorkflowListenerService.DelayPeriod      = TimeSpan.FromSeconds(15);
                server.StartWorkflowByRequestService.DelayPeriod     = TimeSpan.FromSeconds(15);
                server.RefreshWorkflowDefinitionsService.DelayPeriod = TimeSpan.FromMinutes(15);

                server.CustomizeHost += delegate(object sender, CustomizeHostEventArgs e) {
                    e.WorkflowInstanceStoreBehavior.WorkflowInstanceStore.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(15);
                };

                server.CustomHandleException += delegate(object sender, CustomHandleServiceExceptionEventArgs e) {
                    Tracing.Tracer.LogError(e.Exception);
                    e.Handled = false;
                };
            }
            server.Start();
        }
예제 #5
0
        protected override void OnStart(string[] args)
        {
            if (server == null)
            {
                ServerApplication serverApplication = new ServerApplication();
                serverApplication.ApplicationName = "WorkflowExample";
                // The service can only manage workflows for those business classes that are contained in Modules specified by the serverApplication.Modules collection.
                // So, do not forget to add the required Modules to this collection via the serverApplication.Modules.Add method.

                serverApplication.Modules.Add(new WorkflowModule());
                serverApplication.Modules.Add(new WorkflowExampleModule());

                if (ConfigurationManager.ConnectionStrings["ConnectionString"] != null)
                {
                    serverApplication.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
                }
                serverApplication.Setup();
                serverApplication.Logon();

                IObjectSpaceProvider objectSpaceProvider = serverApplication.ObjectSpaceProvider;

                server = new WorkflowServer("http://localhost:46232", objectSpaceProvider, objectSpaceProvider);

                server.StartWorkflowListenerService.DelayPeriod      = TimeSpan.FromSeconds(15);
                server.StartWorkflowByRequestService.DelayPeriod     = TimeSpan.FromSeconds(15);
                server.RefreshWorkflowDefinitionsService.DelayPeriod = TimeSpan.FromMinutes(15);
                server.HostManager.CloseHostTimeout = System.TimeSpan.FromSeconds(20);

                server.CustomizeHost += delegate(object sender, CustomizeHostEventArgs e) {
                    e.WorkflowInstanceStoreBehavior.WorkflowInstanceStore.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(15);
                };

                server.CustomHandleException += delegate(object sender, CustomHandleServiceExceptionEventArgs e) {
                    Tracing.Tracer.LogError(e.Exception);
                    e.Handled = false;
                };
            }
            server.Start();
        }
예제 #6
0
        private void Start_(string connectionString, string applicationName)
        {
            var serverApplication = new ServerApplication();

            //            moduleBases.Each(@base => serverApplication.Modules.Add(@base));
            serverApplication.ApplicationName  = applicationName;
            serverApplication.ConnectionString = connectionString;
            Type securityType = typeof(SecurityComplex).MakeGenericType(new[] { SecuritySystem.UserType, ((ISecurityComplex)SecuritySystem.Instance).RoleType });

            serverApplication.Security = (ISecurity)Activator.CreateInstance(securityType, new WorkflowServerAuthentication(new BinaryOperator("UserName", "WorkflowService")));
            //            serverApplication.Security = new SecurityComplex<User, Role>(
            //                new WorkflowServerAuthentication(new BinaryOperator("UserName", "WorkflowService")));
            serverApplication.Setup();
            serverApplication.Logon();

            IObjectSpaceProvider objectSpaceProvider = serverApplication.ObjectSpaceProvider;

            server = new XpandWorkflowServer(ConfigurationManager.AppSettings["WorkflowServerUrl"], objectSpaceProvider, objectSpaceProvider);
            server.CustomizeHost += delegate(object sender, CustomizeHostEventArgs e) {
                e.WorkflowInstanceStoreBehavior.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(2);
            };
            //            server.WorkflowDefinitionProvider = new WorkflowVersionedDefinitionProvider<XpoWorkflowDefinition, XpoUserActivityVersion>(objectSpaceProvider, null);
            server.WorkflowDefinitionProvider = new XpandWorkflowDefinitionProvider(typeof(XpoWorkflowDefinition), new List <Type> {
                typeof(ScheduledWorkflow), typeof(ObjectChangedWorkflow)
            });
            server.StartWorkflowListenerService.DelayPeriod = TimeSpan.FromSeconds(5);
            server.StartWorkflowByRequestService.RequestsDetectionPeriod = TimeSpan.FromSeconds(5);
            server.RefreshWorkflowDefinitionsService.DelayPeriod         = TimeSpan.FromSeconds(30);

            server.Start();
            server.CustomHandleException += delegate(object sender, DevExpress.ExpressApp.Workflow.ServiceModel.CustomHandleServiceExceptionEventArgs e) {
                Tracing.Tracer.LogError(e.Exception);
                if (OnCustomHandleException_ != null)
                {
                    OnCustomHandleException_(this, new ExceptionEventArgs("Exception occurs:\r\n\r\n" + e.Exception.Message + "\r\n\r\n'" + e.Service.GetType() + "' service"));
                }
                e.Handled = true;
            };
        }
        private void Start_(string connectionString, string applicationName)
        {
            ServerApplication serverApplication = new ServerApplication();

            serverApplication.ApplicationName = applicationName;
            serverApplication.Modules.Add(new WorkflowDemoModule());
            serverApplication.ConnectionString = connectionString;
            serverApplication.Security         = new SecurityComplex <User, Role>(
                new WorkflowServerAuthentication(new BinaryOperator("UserName", "WorkflowService")));
            serverApplication.Setup();
            serverApplication.Logon();

            IObjectSpaceProvider objectSpaceProvider = serverApplication.ObjectSpaceProvider;

            server = new WorkflowServer("http://localhost:46232", objectSpaceProvider, objectSpaceProvider);
            server.WorkflowDefinitionProvider = new WorkflowVersionedDefinitionProvider <XpoWorkflowDefinition, XpoUserActivityVersion>(objectSpaceProvider, null);
            server.StartWorkflowListenerService.DelayPeriod      = TimeSpan.FromSeconds(5);
            server.StartWorkflowByRequestService.DelayPeriod     = TimeSpan.FromSeconds(5);
            server.RefreshWorkflowDefinitionsService.DelayPeriod = TimeSpan.FromSeconds(30);
            server.CustomizeHost += delegate(object sender, CustomizeHostEventArgs e) {
                e.WorkflowInstanceStoreBehavior = null;
                System.ServiceModel.Activities.Description.SqlWorkflowInstanceStoreBehavior sqlWorkflowInstanceStoreBehavior = new System.ServiceModel.Activities.Description.SqlWorkflowInstanceStoreBehavior("Integrated Security=SSPI;Pooling=false;Data Source=.\\SqlExpress;Initial Catalog=SqlWorkflowInstanceStoreDB");
                sqlWorkflowInstanceStoreBehavior.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(2);
                e.Host.Description.Behaviors.Add(sqlWorkflowInstanceStoreBehavior);
                e.WorkflowIdleBehavior.TimeToPersist = TimeSpan.FromSeconds(1);
                //e.WorkflowInstanceStoreBehavior.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(2);
            };

            server.CustomHandleException += delegate(object sender, CustomHandleServiceExceptionEventArgs e) {
                Tracing.Tracer.LogError(e.Exception);
                if (OnCustomHandleException_ != null)
                {
                    OnCustomHandleException_(this, new ExceptionEventArgs("Exception occurs:\r\n\r\n" + e.Exception.Message + "\r\n\r\n'" + e.Service.GetType() + "' service"));
                }
                e.Handled = true;
            };
            server.Start();
        }
예제 #8
0
        public static void WebStart(HttpConfiguration config)
        {
            SignumServer.Start(config, typeof(Global).Assembly);
            AuthServer.Start(config, () => Starter.Configuration.Value.AuthTokens, "IMPORTANT SECRET FROM Southwind. CHANGE THIS STRING!!!");
            CacheServer.Start(config);
            FilesServer.Start(config);
            UserQueryServer.Start(config);
            DashboardServer.Start(config);
            WordServer.Start(config);
            ExcelServer.Start(config);
            ChartServer.Start(config);
            MapServer.Start(config);
            ToolbarServer.Start(config);
            TranslationServer.Start(config, new AlreadyTranslatedTranslator(new AzureTranslator("Your API Key for Azure Translate")));
            SchedulerServer.Start(config);
            ProcessServer.Start(config);
            DisconnectedServer.Start(config);
            MailingServer.Start(config);
            ProfilerServer.Start(config);
            DiffLogServer.Start(config);
            PredictorServer.Start(config);
            WorkflowServer.Start(config);
            DynamicServer.Start(config);

            OmniboxServer.Start(config,
                                new EntityOmniboxResultGenenerator(),
                                new DynamicQueryOmniboxResultGenerator(),
                                new ChartOmniboxResultGenerator(),
                                new DashboardOmniboxResultGenerator(DashboardLogic.Autocomplete),
                                new UserQueryOmniboxResultGenerator(UserQueryLogic.Autocomplete),
                                new UserChartOmniboxResultGenerator(UserChartLogic.Autocomplete),
                                new MapOmniboxResultGenerator(type => OperationLogic.TypeOperations(type).Any()),
                                new ReactSpecialOmniboxGenerator()
                                   //new HelpModuleOmniboxResultGenerator(),
                                ); //Omnibox

            SignumAuthenticationFilterAttribute.GetCurrentCultures = (ac) => GetCulture(ac.Request);
        }
예제 #9
0
        protected override void OnStart(string[] args)
        {
            if (server == null)
            {
                ServerApplication serverApplication;

                try
                {
                    serverApplication = new ServerApplication();
                }
                catch (Exception)
                {
                    throw new Exception("Error i creating server application.");
                }

                try
                {
                    serverApplication.ApplicationName = "Tralus.Shell.WorkflowService";
                    // The service can only manage workflows for those business classes that are contained in Modules specified by the serverApplication.Modules collection.
                    // So, do not forget to add the required Modules to this collection via the serverApplication.Modules.Add method.
                    serverApplication.Modules.BeginInit();

                    var workflowModule = new WorkflowModule();

                    workflowModule.RunningWorkflowInstanceInfoType   = typeof(DevExpress.ExpressApp.Workflow.EF.EFRunningWorkflowInstanceInfo);
                    workflowModule.StartWorkflowRequestType          = typeof(DevExpress.ExpressApp.Workflow.EF.EFStartWorkflowRequest);
                    workflowModule.UserActivityVersionType           = typeof(DevExpress.ExpressApp.Workflow.Versioning.EFUserActivityVersion);
                    workflowModule.WorkflowControlCommandRequestType = typeof(DevExpress.ExpressApp.Workflow.EF.EFWorkflowInstanceControlCommandRequest);
                    workflowModule.WorkflowDefinitionType            = typeof(DevExpress.ExpressApp.Workflow.EF.EFWorkflowDefinition);
                    workflowModule.WorkflowInstanceKeyType           = typeof(DevExpress.Workflow.EF.EFInstanceKey);
                    workflowModule.WorkflowInstanceType = typeof(DevExpress.Workflow.EF.EFWorkflowInstance);

                    serverApplication.Modules.Add(workflowModule);
                    serverApplication.Modules.Add(new ShellModule());
                }
                catch (Exception ex)
                {
                    throw new Exception("Error in creating server", ex);
                }

                try
                {
                    IEnumerable <Type> loadedModuleTypes;
                    ReflectionHelper.GetImportedModules(out loadedModuleTypes, out _loadedContextTypes);

                    foreach (var loadedModuleType in loadedModuleTypes)
                    {
                        var loadedModule = (ModuleBase)Activator.CreateInstance(loadedModuleType);
                        serverApplication.Modules.Insert(0, loadedModule);
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception("Error in loading modules", ex);
                }


                try
                {
                    if (ConfigurationManager.ConnectionStrings["Default"] != null)
                    {
                        serverApplication.ConnectionString = ConfigurationManager.ConnectionStrings["Default"].ConnectionString;
                    }
                    serverApplication.Setup();
                    serverApplication.Logon();
                }
                catch (Exception ex)
                {
                    throw new Exception("Error in setting up.", ex);
                }

                try
                {
                    IObjectSpaceProvider objectSpaceProvider = serverApplication.ObjectSpaceProvider;

                    //WorkflowCreationKnownTypesProvider.AddKnownType(typeof(DevExpress.Xpo.Helpers.IdList));

                    try
                    {
                        server = new WorkflowServer("http://localhost:46232", objectSpaceProvider, objectSpaceProvider);
                    }
                    catch (Exception e)
                    {
                        throw new Exception("Error in creating WorkflowServer.", e);
                    }

                    try
                    {
                        server.StartWorkflowListenerService.DelayPeriod      = TimeSpan.FromSeconds(15);
                        server.StartWorkflowByRequestService.DelayPeriod     = TimeSpan.FromSeconds(15);
                        server.RefreshWorkflowDefinitionsService.DelayPeriod = TimeSpan.FromMinutes(15);
                    }
                    catch (Exception e)
                    {
                        throw new Exception(
                                  $"Error in configuring WorkflowServer. Server={server}, StartWorkflowListenerService={server.StartWorkflowListenerService}, StartWorkflowByRequestService={server.StartWorkflowByRequestService}, RefreshWorkflowDefinitionsService={server.RefreshWorkflowDefinitionsService}", e);
                    }

                    server.CustomizeHost += delegate(object sender, CustomizeHostEventArgs e)
                    {
                        e.WorkflowInstanceStoreBehavior.WorkflowInstanceStore.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(15);
                    };

                    server.CustomHandleException += delegate(object sender, CustomHandleServiceExceptionEventArgs e)
                    {
                        Tracing.Tracer.LogError(e.Exception);
                        e.Handled = false;
                    };
                }
                catch (Exception ex)
                {
                    throw new Exception("Error in configuring server", ex);
                }
            }

            try
            {
                server.Start();
            }
            catch (Exception ex)
            {
                throw new Exception("Error in starting server", ex);
            }
        }
예제 #10
0
파일: Program.cs 프로젝트: aries544/eXpand
        private void Start_(string connectionString, string applicationName) {
            ServerApplication serverApplication = new ServerApplication();
            serverApplication.ApplicationName = applicationName;
            serverApplication.Modules.Add(new WorkflowDemoModule());
            serverApplication.ConnectionString = connectionString;
            serverApplication.Setup();
            serverApplication.Logon();

            IObjectSpaceProvider objectSpaceProvider = serverApplication.ObjectSpaceProvider;

            server = new WorkflowServer("http://localhost:46232", objectSpaceProvider, objectSpaceProvider);
            server.WorkflowDefinitionProvider = new WorkflowVersionedDefinitionProvider<XpoWorkflowDefinition, XpoUserActivityVersion>(objectSpaceProvider, null);
            server.StartWorkflowListenerService.DelayPeriod = TimeSpan.FromSeconds(5);
            server.StartWorkflowByRequestService.DelayPeriod = TimeSpan.FromSeconds(5);
            server.RefreshWorkflowDefinitionsService.DelayPeriod = TimeSpan.FromSeconds(600);
            server.CustomizeHost += delegate(object sender, CustomizeHostEventArgs e) {
                // NOTE: Uncomment this section to use alternative workflow configuration.
                //
                // SqlWorkflowInstanceStoreBehavior
                //
                //e.WorkflowInstanceStoreBehavior = null;
                //System.ServiceModel.Activities.Description.SqlWorkflowInstanceStoreBehavior sqlWorkflowInstanceStoreBehavior = new System.ServiceModel.Activities.Description.SqlWorkflowInstanceStoreBehavior("Integrated Security=SSPI;Pooling=false;Data Source=(local);Initial Catalog=WorkflowsStore");
                //sqlWorkflowInstanceStoreBehavior.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(2);
                //e.Host.Description.Behaviors.Add(sqlWorkflowInstanceStoreBehavior);
                //e.WorkflowIdleBehavior.TimeToPersist = TimeSpan.FromSeconds(1);
                //e.WorkflowIdleBehavior.TimeToPersist = TimeSpan.FromSeconds(10);
                //e.WorkflowIdleBehavior.TimeToUnload = TimeSpan.FromSeconds(10);
                e.WorkflowInstanceStoreBehavior.WorkflowInstanceStore.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(2);
            };

            server.CustomHandleException += delegate(object sender, CustomHandleServiceExceptionEventArgs e) {
                Tracing.Tracer.LogError(e.Exception);
                if(OnCustomHandleException_ != null) {
                    OnCustomHandleException_(this, new ExceptionEventArgs("Exception occurs:\r\n\r\n" + e.Exception.Message + "\r\n\r\n'" + e.Service.GetType() + "' service"));
                }
                e.Handled = true;
            };
            server.Start();
        }
예제 #11
0
        protected override void OnStart(string[] args)
        {
            IObjectSpace newSpace = null;

            if (server == null)
            {
                ServerApplication serverApplication = new ServerApplication();
                serverApplication.ApplicationName        = "Apollo11";
                serverApplication.CheckCompatibilityType = CheckCompatibilityType.DatabaseSchema;
                // The service can only manage workflows for those business classes that are contained in Modules specified by the serverApplication.Modules collection.
                // So, do not forget to add the required Modules to this collection via the serverApplication.Modules.Add method.
                serverApplication.Modules.BeginInit();
                serverApplication.Modules.Add(new WorkflowModule());
                serverApplication.Modules.Add(new Apollo11.Module.Apollo11Module());
                serverApplication.Modules.Add(new Apollo11.Module.Win.Apollo11WindowsFormsModule());
                serverApplication.Modules.Add(new Apollo11.Module.Web.Apollo11AspNetModule());
                if (ConfigurationManager.ConnectionStrings["ConnectionString"] != null)
                {
                    serverApplication.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
                }
                serverApplication.Setup();
                serverApplication.Logon();

                IObjectSpaceProvider objectSpaceProvider = serverApplication.ObjectSpaceProvider;

                WorkflowCreationKnownTypesProvider.AddKnownType(typeof(DevExpress.Xpo.Helpers.IdList));

                server = new WorkflowServer("http://localhost:46232", objectSpaceProvider, objectSpaceProvider);
                server.StartWorkflowListenerService.DelayPeriod      = TimeSpan.FromSeconds(15);
                server.StartWorkflowByRequestService.DelayPeriod     = TimeSpan.FromSeconds(15);
                server.RefreshWorkflowDefinitionsService.DelayPeriod = TimeSpan.FromMinutes(15);

                server.CustomizeHost += delegate(object sender, CustomizeHostEventArgs e) {
                    e.WorkflowInstanceStoreBehavior.WorkflowInstanceStore.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(15);
                };

                server.CustomHandleException += delegate(object sender, CustomHandleServiceExceptionEventArgs e) {
                    Tracing.Tracer.LogError(e.Exception);
                    e.Handled = false;
                };



                //init APIS

                BitfinexRestAPI bitapi = new BitfinexRestAPI();
                Quadrigacx      quaAPI = new Quadrigacx(objectSpaceProvider.CreateObjectSpace());


                Arguements package = new Arguements();
                package.BitAPI  = bitapi;
                package.QuadAPI = quaAPI;

                package.Space = objectSpaceProvider.CreateObjectSpace();

                //    bitapi.CreateTrade(Convert.ToDecimal(1186.1),Convert.ToDecimal(0.016),TradeType.Buy);

                //    Console.WriteLine("Created trade " + DateTime.Now.ToString());
                //   Console.ReadLine();



                //
                //start logging live quad data from html site
                BackgroundWorker qwrBW = new BackgroundWorker();

                qwrBW.DoWork             += Qwr_DoWork;
                qwrBW.RunWorkerCompleted += QwrBW_RunWorkerCompleted;
                qwrBW.ProgressChanged    += QwrBW_ProgressChanged;



                //      qwrBW.RunWorkerAsync(objectSpaceProvider.CreateObjectSpace());
                qwrBW.RunWorkerAsync(objectSpaceProvider.CreateObjectSpace());

                //
                //statrt logging bitstamp data

                //BackgroundWorker bWBitStamp = new BackgroundWorker();
                //bWBitStamp.DoWork += QwrBitStamp_DoWork;
                //bWBitStamp.RunWorkerCompleted += QwrBitStamp_RunWorkerCompleted;
                //bWBitStamp.ProgressChanged += QwrBitStamp_ProgressChanged;

                //bWBitStamp.RunWorkerAsync(objectSpaceProvider.CreateObjectSpace());
                //    StartLiveBitStampScraper(objectSpaceProvider.CreateObjectSpace());



                //
                //start logging Bitfinex orders
                BackgroundWorker bwBitFinex = new BackgroundWorker();
                bwBitFinex.DoWork             += BwBitFinex_DoWork;
                bwBitFinex.RunWorkerCompleted += BwBitFinex_RunWorkerCompleted;
                bwBitFinex.ProgressChanged    += BwBitFinex_ProgressChanged;

                bwBitFinex.RunWorkerAsync(package);



                //create trade
                //       Quadrigacx API = new Quadrigacx(objectSpaceProvider.CreateObjectSpace());



                //  Console.WriteLine(DateTime.Now.ToLongTimeString() + " creating trade");
                //    API.CreateSellTrade(Convert.ToDecimal( 0.005), Convert.ToDecimal(1130.98));

                //API.CreateBuyTrade(Convert.ToDecimal(0.005), Convert.ToDecimal(1110.98));

                //var orders = API.QuadrigaAPIClient.GetOpenOrders("btc_cad");
                //  Console.WriteLine(orders.Count().ToString());
            }
            server.Start();
            LogMessage(DateTime.Now + " Server Started ...");
        }
예제 #12
0
 public void Start()
 {
     server.Start();
 }