Ejemplo n.º 1
0
        public async Task <ActivityResponse> ExecuteAsync(Activity activity, ActivityArgs activityArgs, CancellationToken cancellationToken)
        {
            var executionStrategy = ExecutionStrategy.CreateFor(_executeMethod);
            var parameters        = _executeMethod.BuildParametersFrom(activityArgs, cancellationToken);

            return(await executionStrategy.Execute(this, activity, parameters, activityArgs.TaskToken));
        }
Ejemplo n.º 2
0
        private async Task <ActivityResponse> ExecuteActivityTask(ActivityHost activityHost)
        {
            var activity     = activityHost.FindBy(_activityTask.ActivityType.Name, _activityTask.ActivityType.Version);
            var activityArgs = new ActivityArgs(_activityTask.Input,
                                                _activityTask.ActivityId,
                                                _activityTask.WorkflowExecution.WorkflowId,
                                                _activityTask.WorkflowExecution.RunId,
                                                _activityTask.TaskToken);

            activityArgs.StartedEventId = _activityTask.StartedEventId;
            activity.SetErrorHandler(_errorHandler);
            activity.SetSwfApi(_heartbeatSwfApi);
            return(await activity.ExecuteAsync(activityArgs));
        }
Ejemplo n.º 3
0
 internal async Task <ActivityResponse> ExecuteAsync(ActivityArgs activityArgs)
 {
     try
     {
         Hearbeat.SetFallbackErrorHandler(_errorHandler);
         Hearbeat.StartHeartbeatIfEnabled(_heartbeatApi, activityArgs.TaskToken);
         var retryableFunc = new RetryableFunc(_errorHandler);
         return(await retryableFunc.ExecuteAsync(() => ExecuteActivityMethod(activityArgs), Defer));
     }
     finally
     {
         Hearbeat.StopHeartbeat();
     }
 }
Ejemplo n.º 4
0
 private async Task <ActivityResponse> ExecuteActivityMethod(ActivityArgs activityArgs)
 {
     try
     {
         return(await _executionMethod.ExecuteAsync(this, activityArgs, _cancellationTokenSource.Token));
     }
     catch (OperationCanceledException exception)
     {
         return(Cancel(exception.Message));
     }
     catch (Exception exception)
     {
         if (FailOnException)
         {
             return(Fail(exception.GetType().Name, exception.Message));
         }
         throw;
     }
 }
Ejemplo n.º 5
0
 private async Task <ActivityResponse> ExecuteActivityMethod(ActivityArgs activityArgs)
 {
     try
     {
         return(await _executionMethod.ExecuteAsync(this, activityArgs, _cancellationTokenSource.Token));
     }
     catch (OperationCanceledException exception)
     {
         var desc = ActivityDescription.FindOn(GetType());
         return(Cancel($"Activity name: {desc.Name} and version: { desc.Version} is cancelled."));
     }
     catch (Exception exception)
     {
         if (FailOnException)
         {
             return(Fail(exception.GetType().Name, exception.Message));
         }
         throw;
     }
 }