コード例 #1
0
        private IStep DoLoadStep()
        {
            if (_step.Batchlet != null)
            {
                var builder = new TaskletStepBuilder(_container, _step.Id, Int32.Parse(_step.DelayConfig)).Tasklet(_step.Batchlet.Ref);
                builder.Repository(_container.Resolve <IJobRepository>());
                AddListeners(builder);
                return(builder.Build());
            }
            if (_step.Chunk != null)
            {
                var inType  = GetTypeParameter(_container, typeof(IItemReader <>), _step.Chunk.Reader.Ref);
                var outType = GetTypeParameter(_container, typeof(IItemWriter <>), _step.Chunk.Writer.Ref);
                var builder = new SimpleStepBuilder(_container, _step.Id, inType, outType, Int32.Parse(_step.DelayConfig))
                              .Reader(_step.Chunk.Reader.Ref)
                              .Writer(_step.Chunk.Writer.Ref);

                // To determine the master step and create remotechunking inject to the stepexecution
                if (_step.RemoteChunking != null)
                {
                    RemoteChunking remoteChunking = new RemoteChunking(_step.RemoteChunking.HostName, _step.RemoteChunking.UserName, _step.RemoteChunking.PassWord, _step.RemoteChunking.Master);

                    // set worker configuration in the master
                    if (_step.RemoteChunking.Master)
                    {
                        remoteChunking.WorkerFileName  = _step.RemoteChunking.WorkerFileName;
                        remoteChunking.WorkerMaxNumber = int.Parse(_step.RemoteChunking.WorkerMaxNumber);
                    }
                    else // worker
                    {
                        // set worker id into the remotechunking object
                        if (!string.IsNullOrEmpty(_step.RemoteChunking.WorkerID))
                        {
                            remoteChunking.WorkerID = _step.RemoteChunking.WorkerID;
                        }
                    }

                    remoteChunking.MaxMasterWaitWorkerRetry   = int.Parse(_step.RemoteChunking.MaxMasterWaitWorkerRetry);
                    remoteChunking.MaxMasterWaitWorkerSecond  = int.Parse(_step.RemoteChunking.MaxMasterWaitWorkerSecond);
                    remoteChunking.RemoteChunkingTimoutSecond = TimeSpan.FromSeconds(int.Parse(_step.RemoteChunking.RemoteChunkingTimoutSecond));

                    builder = new SimpleStepBuilder(_container, _step.Id, inType, outType, Int32.Parse(_step.DelayConfig), remoteChunking)
                              .Reader(_step.Chunk.Reader.Ref)
                              .Writer(_step.Chunk.Writer.Ref);
                }

                if (_step.Chunk.Processor != null && !string.IsNullOrEmpty(_step.Chunk.Processor.Ref))
                {
                    builder.Processor(_step.Chunk.Processor.Ref);
                }
                if (!string.IsNullOrEmpty(_step.Chunk.ItemCount))
                {
                    builder.ChunkSize(int.Parse(_step.Chunk.ItemCount));
                }
                builder.Repository(_container.Resolve <IJobRepository>());
                AddListeners(builder);
                return(builder.Build());
            }
            throw new ArgumentException("A Batchlet or a chunk must be provided in the step");
        }
コード例 #2
0
 private IStep DoLoadStep()
 {
     if (_step.Batchlet != null)
     {
         var builder = new TaskletStepBuilder(_container, _step.Id).Tasklet(_step.Batchlet.Ref);
         builder.Repository(_container.Resolve <IJobRepository>());
         AddListeners(builder);
         return(builder.Build());
     }
     if (_step.Chunk != null)
     {
         var inType  = GetTypeParameter(_container, typeof(IItemReader <>), _step.Chunk.Reader.Ref);
         var outType = GetTypeParameter(_container, typeof(IItemWriter <>), _step.Chunk.Writer.Ref);
         var builder = new SimpleStepBuilder(_container, _step.Id, inType, outType)
                       .Reader(_step.Chunk.Reader.Ref)
                       .Writer(_step.Chunk.Writer.Ref);
         if (_step.Chunk.Processor != null && !string.IsNullOrEmpty(_step.Chunk.Processor.Ref))
         {
             builder.Processor(_step.Chunk.Processor.Ref);
         }
         if (!string.IsNullOrEmpty(_step.Chunk.ItemCount))
         {
             builder.ChunkSize(int.Parse(_step.Chunk.ItemCount));
         }
         builder.Repository(_container.Resolve <IJobRepository>());
         AddListeners(builder);
         return(builder.Build());
     }
     throw new ArgumentException("A Batchlet or a chunk must be provided in the step");
 }