/// <summary>
        /// Push next acivity fromt the list
        /// </summary>
        /// <returns>True - activity was successfully sent to EMR,
        /// False - either no more activities or an erorr occured while sending a request to EMR
        /// </returns>
        private async Task <bool> SendNextActivity()
        {
            if (!this.activities.MoveNext())
            {
                this.EmrJobLogger.PrintCompleted(this.hasErrors);
                return(false);
            }

            EmrActivity activity = this.activities.Current;

            this.EmrJobLogger.PrintAddingNewActivity(activity.Name);

            //TODO: probably add a retry cycle
            string resultJobFlowId;

            try
            {
                resultJobFlowId = await activity.SendAsync(this.EmrClient, this.Settings, this.JobFlowId);
            }
            catch (Exception ex)
            {
                this.SetError(String.Format(Resources.Info_ExceptionWhenSendingRequestTemplate, ex.Message));
                return(false);
            }

            if (String.IsNullOrEmpty(resultJobFlowId))
            {
                this.SetError(Resources.Info_EmrServiceNotOkResponse);
                return(false);
            }

            this.JobFlowId = resultJobFlowId;
            return(true);
        }
示例#2
0
 public SingleEmrActivityIterator(SwfActivity swfActivity)
 {
     this.emrActivity = SingleEmrActivityIterator.CreateStrategy(swfActivity);
 }