Beispiel #1
0
        protected override async Task SucceedActivityAsync(string taskToken, string result)
        {
            var activityCompletedRequest = new RespondActivityTaskCompletedRequest
            {
                TaskToken = taskToken,
                Result    = result
            };

            await _amazonSimpleWorkflowClient.RespondActivityTaskCompletedAsync(activityCompletedRequest);
        }
Beispiel #2
0
 public void Worker(string tasklistName)
 {
     while (true)
     {
         Console.WriteLine("Starting Worker" + tasklistName + ": Polling for activity...");
         PollForActivityTaskRequest pollForActivityTaskRequest =
             new PollForActivityTaskRequest()
         {
             Domain   = domainName,
             TaskList = new TaskList()
             {
                 Name = tasklistName
             }
         };
         PollForActivityTaskResponse pollForActivityTaskResponse = swfClient.PollForActivityTaskAsync(pollForActivityTaskRequest).Result;
         Console.WriteLine("finished polling pollForActivityTaskResponse");
         RespondActivityTaskCompletedRequest respondActivityTaskCompletedRequest =
             //Ideally this function would actually do something and return real values. But since it's just hello
             //world we're returning nothing of value. (a static string)
             new RespondActivityTaskCompletedRequest()
         {
             Result    = "{\"customReturnValue\":\"CustomReturnResult\"}",
             TaskToken = pollForActivityTaskResponse.ActivityTask.TaskToken
         };
         if (pollForActivityTaskResponse.ActivityTask.ActivityId == null)
         {
             Console.WriteLine("Starting Worker" + tasklistName + ": NULL");
         }
         else
         {
             RespondActivityTaskCompletedResponse respondActivityTaskCompletedResponse =
                 swfClient.RespondActivityTaskCompletedAsync(respondActivityTaskCompletedRequest).Result;
             Console.WriteLine("Starting Worker" + tasklistName + ": Activity completed" + pollForActivityTaskResponse.ActivityTask.ActivityId);
         }
     }
 }