コード例 #1
0
        private void CreateEnvironment()
        {
            var envConfig = new ServiceEnvironmentConfiguration
            {
                DefaultHostName   = "Johnny",
                ConnectionString  = "Data Source=bi_rnd;Initial Catalog=EdgeSystem;Integrated Security=true",
                SP_HostListGet    = "Service_HostList",
                SP_HostRegister   = "Service_HostRegister",
                SP_HostUnregister = "Service_HostUnregister",
                SP_InstanceSave   = "Service_InstanceSave",
                SP_InstanceGet    = "Service_InstanceGet",
                SP_InstanceReset  = "Service_InstanceReset",
                SP_EnvironmentEventListenerListGet    = "Service_EnvironmentEventListenerListGet",
                SP_EnvironmentEventListenerRegister   = "Service_EnvironmentEventListenerRegister",
                SP_EnvironmentEventListenerUnregister = "Service_EnvironmentEventListenerUnregister",
                SP_ServicesExecutionStatistics        = "Service_ExecutionStatistics_GetByPercentile",
                SP_InstanceActiveListGet = "Service_InstanceActiveList_GetByTime"
            };

            _environment = ServiceEnvironment.Open("Scheduler UI", envConfig);
            _listener    = _environment.ListenForEvents(ServiceEnvironmentEventType.ScheduleUpdated);
            _listener.ScheduleUpdated += Listener_ScheduleUpdated;

            //_host = new ServiceExecutionHost(_environment.EnvironmentConfiguration.DefaultHostName, _environment);
        }
コード例 #2
0
        static void Main()
        {
            log4net.Config.XmlConfigurator.Configure();
            Log.Start();

            // Create Environment and host
            var envConfig = new ServiceEnvironmentConfiguration
            {
                DefaultHostName   = "Johnny",
                ConnectionString  = "Data Source=bi_rnd;Initial Catalog=EdgeSystem;Integrated Security=true",
                SP_HostListGet    = "Service_HostList",
                SP_HostRegister   = "Service_HostRegister",
                SP_HostUnregister = "Service_HostUnregister",
                SP_InstanceSave   = "Service_InstanceSave",
                SP_InstanceGet    = "Service_InstanceGet",
                SP_InstanceReset  = "Service_InstanceReset",
                SP_EnvironmentEventListenerListGet    = "Service_EnvironmentEventListenerListGet",
                SP_EnvironmentEventListenerRegister   = "Service_EnvironmentEventListenerRegister",
                SP_EnvironmentEventListenerUnregister = "Service_EnvironmentEventListenerUnregister",
                SP_ServicesExecutionStatistics        = "Service_ExecutionStatistics_GetByPercentile",
                SP_InstanceActiveListGet = "Service_InstanceActiveList_GetByTime"
            };

            var environment = ServiceEnvironment.Open("Environment Test", envConfig);
            var host        = new ServiceExecutionHost(environment.EnvironmentConfiguration.DefaultHostName, environment);

            Log.Write("TestEnvironment", "Started Environment", LogMessageType.Debug);

            do
            {
            } while (Console.ReadLine() != "exit");
        }
コード例 #3
0
        static void Main1(string[] args)
        {
            log4net.Config.XmlConfigurator.Configure();

            Log.Write("Test scheduling", "Current time=" + DateTime.Now, LogMessageType.Debug);
            Log.Write("Test scheduling", "Test 1234", LogMessageType.Debug);

            // create service env
            var envConfig = new ServiceEnvironmentConfiguration()
            {
                DefaultHostName   = "Johnny",
                ConnectionString  = "Data Source=bi_rnd;Initial Catalog=EdgeSystem;Integrated Security=true",
                SP_HostRegister   = "Service_HostRegister",
                SP_HostUnregister = "Service_HostUnregister",
                SP_InstanceSave   = "Service_InstanceSave",
                SP_InstanceGet    = "Service_InstanceGet",
                SP_InstanceReset  = "Service_InstanceReset",
                SP_ServicesExecutionStatistics = "Service_ExecutionStatistics_GetByPercentile",
                SP_InstanceActiveListGet       = "Service_InstanceActiveList_GetByTime"
            };
            var environment = ServiceEnvironment.Open(envConfig);

            // generate scheduler config, create scheduler and start it
            var schedulerConfig = GenerateConfigForScheduler();
            var scheduler       = new Scheduler(environment, schedulerConfig);

            scheduler.Start();

            do
            {
            } while (Console.ReadLine() != "exit");

            scheduler.Stop();
        }
コード例 #4
0
        protected ServiceEnvironment CreateEnvironment()
        {
            // create service env
            var envConfig = new ServiceEnvironmentConfiguration
            {
                DefaultHostName   = "Shira",
                ConnectionString  = "Data Source=bi_rnd;Initial Catalog=EdgeSystem;Integrated Security=true",
                SP_HostListGet    = "Service_HostList",
                SP_HostRegister   = "Service_HostRegister",
                SP_HostUnregister = "Service_HostUnregister",
                SP_InstanceSave   = "Service_InstanceSave",
                SP_InstanceGet    = "Service_InstanceGet",
                SP_InstanceReset  = "Service_InstanceReset",
                SP_EnvironmentEventListenerListGet    = "Service_EnvironmentEventListenerListGet",
                SP_EnvironmentEventListenerRegister   = "Service_EnvironmentEventListenerRegister",
                SP_EnvironmentEventListenerUnregister = "Service_EnvironmentEventListenerUnregister",
                SP_ServicesExecutionStatistics        = "Service_ExecutionStatistics_GetByPercentile",
                SP_InstanceActiveListGet = "Service_InstanceActiveList_GetByTime"
            };

            var environment = ServiceEnvironment.Open("Pipeline Test", envConfig);

            return(environment);
        }
コード例 #5
0
        static void Main(string[] args)
        {
            // ..........................................................
            // STEP 1 - host

            var envConfig = new ServiceEnvironmentConfiguration()
            {
                DefaultHostName   = "Johnny",
                ConnectionString  = "Data Source=bi_rnd;Initial Catalog=EdgeSystem;Integrated Security=true",
                SP_HostListGet    = "Service_HostList",
                SP_HostRegister   = "Service_HostRegister",
                SP_HostUnregister = "Service_HostUnregister",
                SP_InstanceSave   = "Service_InstanceSave",
                SP_InstanceGet    = "Service_InstanceGet",
                SP_InstanceReset  = "Service_InstanceReset",
                SP_EnvironmentEventListenerListGet    = "Service_EnvironmentEventListenerListGet",
                SP_EnvironmentEventListenerRegister   = "Service_EnvironmentEventListenerRegister",
                SP_EnvironmentEventListenerUnregister = "Service_EnvironmentEventListenerUnregister"
            };

            var environment = ServiceEnvironment.Open("Test Host", envConfig);

            using (var host = new ServiceExecutionHost(environment.EnvironmentConfiguration.DefaultHostName, environment))
            {
                // Disabled for now - work in progress
                using (ServiceEnvironmentEventListener listener = environment.ListenForEvents(ServiceEnvironmentEventType.ServiceRequiresScheduling))
                {
                    listener.ServiceRequiresScheduling += new EventHandler <ServiceInstanceEventArgs>(Environment_ServiceRequiresScheduling);

                    // ..........................................................
                    // STEP 2 - service

                    var serviceTemplate = new ServiceConfiguration()
                    {
                        IsEnabled    = true,
                        ServiceName  = "Test",
                        ServiceClass = typeof(TestService).AssemblyQualifiedName,
                        HostName     = "Johnny"
                    };


                    #region workflow

                    // ..........................................................
                    // workflow example

                    var stepConfig = new ServiceConfiguration()
                    {
                        ServiceClass = typeof(WorkflowStepExample).AssemblyQualifiedName
                    };

                    var workflowConfig = new WorkflowServiceConfiguration()
                    {
                        ServiceName = "PipelineExample"
                    };
                    workflowConfig.Workflow = new WorkflowNodeGroup()
                    {
                        Mode  = WorkflowNodeGroupMode.Linear,
                        Nodes = new LockableList <WorkflowNode>()
                        {
                            new WorkflowStep()
                            {
                                Name = "Initializer", ServiceConfiguration = stepConfig
                            },
                            new WorkflowStep()
                            {
                                Name = "Retriever", ServiceConfiguration = stepConfig
                            },
                            new WorkflowStep()
                            {
                                Name = "Processor", ServiceConfiguration = stepConfig
                            },
                            new WorkflowStep()
                            {
                                Name = "Transform", ServiceConfiguration = stepConfig
                            },
                            new WorkflowStep()
                            {
                                Name = "Stage", ServiceConfiguration = stepConfig
                            },
                            new WorkflowStep()
                            {
                                Name = "Commit", ServiceConfiguration = stepConfig
                            },
                            new WorkflowStep()
                            {
                                Name = "Cubes", ServiceConfiguration = stepConfig
                            },
                        }
                    };

                    #endregion

                    // ..........................................................
                    var profile = new ServiceProfile()
                    {
                        Name = "Doron"
                    };
                    profile.Parameters["AccountID"] = 10035;

                    ServiceConfiguration profileService = profile.DeriveConfiguration(workflowConfig);

                    while (Console.ReadKey().Key != ConsoleKey.Escape)
                    {
                        ServiceInstance instance = environment.NewServiceInstance(profileService);
                        instance.StateChanged    += new EventHandler(instance_StateChanged);
                        instance.OutputGenerated += new EventHandler <ServiceOutputEventArgs>(instance_OutputGenerated);
                        instance.Start();
                    }
                }
            }
        }