예제 #1
0
        /// <summary>
        /// Registers activity type for a specific version.
        /// </summary>
        /// <param name="domainName">Domain where the activity type should be registered.</param>
        /// <param name="client">Interface for accessing Amazon Simple Workflow Service.</param>
        void IRegistrable.Register(string domainName, IAmazonSimpleWorkflow client)
        {
            var listActivityRequest = new ListActivityTypesRequest
            {
                Domain             = domainName,
                Name               = Options.Name,
                RegistrationStatus = RegistrationStatus.REGISTERED
            };


            if (
                client.ListActivityTypesAsync(listActivityRequest).Result
                .ActivityTypeInfos.TypeInfos.FirstOrDefault(x => x.ActivityType.Version == Options.Version) == null)
            {
                Logger.Trace("New Activity Type.");

                RegisterActivityTypeRequest request = new RegisterActivityTypeRequest
                {
                    Name            = Options.Name,
                    Domain          = domainName,
                    Description     = Options.Description,
                    Version         = Options.Version,
                    DefaultTaskList = TaskList,                     //Worker poll based on this
                    DefaultTaskScheduleToCloseTimeout = Options.ScheduleToCloseTimeout.ToStringOrNone(),
                    DefaultTaskScheduleToStartTimeout = Options.ScheduleToStartTimeout.ToStringOrNone(),
                    DefaultTaskStartToCloseTimeout    = Options.StartToCloseTimeout.ToStringOrNone(),
                    DefaultTaskHeartbeatTimeout       = Options.HeartbeatTimeout.ToStringOrNone()
                };

                client.RegisterActivityTypeAsync(request).Wait();
            }

            Logger.Trace("Activity. Name: {0}, Version: {1}", Options.Name, Options.Version);
        }
예제 #2
0
        private async Task RegisterActivityAsync(ActivityDescription activityDescription)
        {
            Ensure.NotNull(activityDescription, "activityDescription");
            var registeredActivitiesInfo = await ListActivitiesFromAmazonBy(activityDescription.Name);

            var activityToRegister = registeredActivitiesInfo.FirstOrDefault(w => w.ActivityType.Version.Equals(activityDescription.Version));

            if (activityToRegister != null)
            {
                return;
            }

            await _simpleWorkflowClient.RegisterActivityTypeAsync(activityDescription.RegisterRequest(_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;
     }
 }