コード例 #1
0
        public static void RegisterActivity(IAmazonSimpleWorkflow swfClient, string domainName, string name, string tasklistName)
        {
            // Register activities if it is not already registered
            var listActivityRequest = new ListActivityTypesRequest()
            {
                Domain             = domainName,
                Name               = name,
                RegistrationStatus = RegistrationStatus.REGISTERED
            };

            if (swfClient.ListActivityTypes(listActivityRequest).ActivityTypeInfos.TypeInfos.FirstOrDefault(
                    x => x.ActivityType.Version == "2.0") == null)
            {
                RegisterActivityTypeRequest request = new RegisterActivityTypeRequest()
                {
                    Name            = name,
                    Domain          = domainName,
                    Description     = "Hello World Activities",
                    Version         = "2.0",
                    DefaultTaskList = new TaskList()
                    {
                        Name = tasklistName
                    },                                                       //Worker poll based on this
                    DefaultTaskScheduleToCloseTimeout = "300",
                    DefaultTaskScheduleToStartTimeout = "150",
                    DefaultTaskStartToCloseTimeout    = "450",
                    DefaultTaskHeartbeatTimeout       = "NONE",
                };
                swfClient.RegisterActivityType(request);
                Console.WriteLine("Setup: Created Activity Name - " + request.Name);
            }
        }
コード例 #2
0
        static void RegisterActivity(string name, string tasklistName)
        {
            // Register activities if it is not already registered
            var listActivityRequest = new ListActivityTypesRequest()
            {
                Domain             = domainName,
                Name               = name,
                RegistrationStatus = RegistrationStatus.REGISTERED
            };

            if (SwfClient.ListActivityTypes(listActivityRequest).ActivityTypeInfos.TypeInfos.FirstOrDefault(
                    x => x.ActivityType.Version == "2.0") == null)
            {
                var request = new RegisterActivityTypeRequest()
                {
                    Name            = name,
                    Domain          = domainName,
                    Description     = "Swf Demo Activities",
                    Version         = "2.0",
                    DefaultTaskList = new TaskList()
                    {
                        Name = tasklistName
                    },                                                       //Worker poll based on this
                    DefaultTaskScheduleToCloseTimeout = "300",
                    DefaultTaskScheduleToStartTimeout = "150",
                    DefaultTaskStartToCloseTimeout    = "450",
                    DefaultTaskHeartbeatTimeout       = "NONE",
                };
                try
                {
                }
                catch (TypeAlreadyExistsException tex)
                {
                    SwfClient.RegisterActivityType(request);
                }
                Console.WriteLine($"INITIATOR: Created Activity Name - {request.Name}");
            }
        }
コード例 #3
0
 private Amazon.SimpleWorkflow.Model.RegisterActivityTypeResponse CallAWSServiceOperation(IAmazonSimpleWorkflow client, Amazon.SimpleWorkflow.Model.RegisterActivityTypeRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Simple Workflow Service (SWF)", "RegisterActivityType");
     try
     {
         #if DESKTOP
         return(client.RegisterActivityType(request));
         #elif CORECLR
         return(client.RegisterActivityTypeAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }