Exemplo n.º 1
0
        public Job(Guid jobId, string name, List <DataSource> sourceDataSources, DataSource targetDataSource, List <JobStep> steps, JobPriority priority, JobTerminateOnErrorType terminateOnErrorType, LoggingLevel loggingLevel, bool isEnabled = true)
            : this(jobId, name, sourceDataSources, targetDataSource, steps, isEnabled)
        {
            Priority = priority;

            TerminateOnErrorType = terminateOnErrorType;

            LoggingLevel = loggingLevel;
        }
Exemplo n.º 2
0
        public void ExecuteJob(string jobName, JobTerminateOnErrorType jobTerminateOnErrorType, Type[] jobStepTypes)
        {
            var job = new Job(Guid.NewGuid(), jobName);

            job.TerminateOnErrorType = jobTerminateOnErrorType;

            job.AddDataSource(_sourceSideDataSource, SyncSide.Source);
            job.AddDataSource(_targetSideDataSource, SyncSide.Target);

            foreach (var jobStepType in jobStepTypes)
            {
                var jobStep = new JobStep(Guid.NewGuid(), jobStepType.Name, jobStepType.FullName);

                job.AddStep(jobStep);
            }

            JobQueueManager.QueueJob(_integration, _sourceSideDataSource, job, DateTime.Now, Path.GetFileName(Assembly.GetCallingAssembly().Location), JobInvocationSourceType.OnDemand);

            while (JobQueueManager.HasWaitingJobs || JobQueueManager.HasRunningJobs)
            {
                Thread.Sleep(500);
            }
        }