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"); }
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(); } } } }