Ejemplo n.º 1
0
        public static IOrchestrationConfiguration MapCommand <T>(this IOrchestrationConfiguration configuration, string orchestrationName, Func <ICommand, TimeSpan> orchestrationTimeout = null)
            where T : IProviderCommand
        {
            if (configuration is null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            if (string.IsNullOrEmpty(orchestrationName))
            {
                throw new ArgumentException("Cannot be null or empty.", nameof(orchestrationName));
            }

            if (!FunctionsEnvironment.FunctionExists(orchestrationName))
            {
                throw new ArgumentOutOfRangeException(nameof(orchestrationName), $"Could not find orchstration by name '{orchestrationName}'");
            }

            configuration.Orchestrations[typeof(T)] = new OrchestrationSettings()
            {
                OrchestrationName   = orchestrationName,
                OrchstrationTimeout = orchestrationTimeout ?? OrchestrationSettings.DefaultOrchestrationTimeout
            };

            return(configuration);
        }
Ejemplo n.º 2
0
        public bool CanHandle(IOrchestratorCommand orchestratorCommand)
        {
            if (orchestratorCommand is null)
            {
                throw new ArgumentNullException(nameof(orchestratorCommand));
            }

            var orchestrationName = GetCommandOrchestrationName(orchestratorCommand);

            return(FunctionsEnvironment.FunctionExists(orchestrationName));
        }