/// <inheritdoc/>
        public DurabilityProvider GetDurabilityProvider()
        {
            if (this.defaultProvider == null)
            {
                var settings = this.GetNetheriteOrchestrationServiceSettings();

                if (this.TraceToBlob && BlobLogger == null)
                {
                    BlobLogger = new BlobLogger(settings.ResolvedStorageConnectionString, settings.WorkerId);
                }

                var key = new DurableClientAttribute()
                {
                    TaskHub        = settings.HubName,
                    ConnectionName = settings.ResolvedStorageConnectionString,
                };

                this.defaultProvider = this.cachedProviders.GetOrAdd(key, _ =>
                {
                    var service = new NetheriteOrchestrationService(settings, this.loggerFactory);
                    return(new NetheriteProvider(service, settings));
                });
            }

            return(this.defaultProvider);
        }
 public NetheriteProvider(
     NetheriteOrchestrationService service,
     NetheriteOrchestrationServiceSettings settings)
     : base("Netherite", service, service, settings.ResolvedStorageConnectionString)
 {
     this.Service  = service;
     this.Settings = settings;
 }
        public async void SingleServiceQuery()
        {
            Trace.WriteLine("Starting the orchestration service...");
            var settings = TestConstants.GetNetheriteOrchestrationServiceSettings();
            var service  = new NetheriteOrchestrationService(settings, this.loggerFactory);
            await service.CreateAsync(true);

            await service.StartAsync();

            Trace.WriteLine("Orchestration service is started.");

            var _ = await service.GetOrchestrationStateAsync();

            Trace.WriteLine("shutting down the orchestration service...");
            await service.StopAsync();

            Trace.WriteLine("Orchestration service is shut down.");
        }
示例#4
0
        public TestOrchestrationHost(NetheriteOrchestrationServiceSettings settings, ILoggerFactory loggerFactory)
        {
            this.orchestrationService = new Netherite.NetheriteOrchestrationService(settings, loggerFactory);

            if (TestConstants.DeleteStorageBeforeRunningTests)
            {
                this.orchestrationService.DeleteAsync().GetAwaiter().GetResult();
            }

            this.orchestrationService.CreateAsync(false).GetAwaiter().GetResult();

            this.settings = settings;

            this.worker = new TaskHubWorker(this.orchestrationService);
            this.client = new TaskHubClient(this.orchestrationService);
            this.addedOrchestrationTypes = new HashSet <Type>();
            this.addedActivityTypes      = new HashSet <Type>();
        }
        // Called by the Durable client binding infrastructure
        public DurabilityProvider GetDurabilityProvider(DurableClientAttribute attribute)
        {
            var settings = this.GetNetheriteOrchestrationServiceSettings(attribute.TaskHub);

            if (string.Equals(this.defaultProvider.Settings.HubName, settings.HubName, StringComparison.OrdinalIgnoreCase) &&
                string.Equals(this.defaultProvider.Settings.ResolvedStorageConnectionString, settings.ResolvedStorageConnectionString, StringComparison.OrdinalIgnoreCase))
            {
                return(this.defaultProvider);
            }

            DurableClientAttribute key = new DurableClientAttribute()
            {
                TaskHub        = settings.HubName,
                ConnectionName = settings.ResolvedStorageConnectionString,
            };

            return(this.cachedProviders.GetOrAdd(key, _ =>
            {
                //TODO support client-only version
                var service = new NetheriteOrchestrationService(settings, this.loggerFactory);
                return new NetheriteProvider(service, settings);
            }));
        }