/// <summary> /// Creates the default <see cref="DurabilityProvider"/>. /// </summary> /// <param name="storageProviderName">The name of the storage backend providing the durability.</param> /// <param name="service">The internal <see cref="IOrchestrationService"/> that provides functionality /// for this classes implementions of <see cref="IOrchestrationService"/>.</param> /// <param name="serviceClient">The internal <see cref="IOrchestrationServiceClient"/> that provides functionality /// for this classes implementions of <see cref="IOrchestrationServiceClient"/>.</param> /// <param name="connectionName">The name of the app setting that stores connection details for the storage provider.</param> public DurabilityProvider(string storageProviderName, IOrchestrationService service, IOrchestrationServiceClient serviceClient, string connectionName) { this.name = storageProviderName ?? throw new ArgumentNullException(nameof(storageProviderName)); this.innerService = service ?? throw new ArgumentNullException(nameof(service)); this.innerServiceClient = serviceClient ?? throw new ArgumentNullException(nameof(serviceClient)); this.connectionName = connectionName ?? throw new ArgumentNullException(connectionName); }
public SqlDurabilityProvider( SqlOrchestrationService service, SqlDurabilityOptions durabilityOptions, IOrchestrationServiceClient client) : base(Name, service, client, durabilityOptions.ConnectionStringName) { this.service = service ?? throw new ArgumentNullException(nameof(service)); this.durabilityOptions = durabilityOptions; }
/// <summary> /// Create a new TaskHubClient with the given OrchestrationServiceClient /// </summary> /// <param name="serviceClient">Object implementing the <see cref="IOrchestrationServiceClient"/> interface </param> public TaskHubClient(IOrchestrationServiceClient serviceClient) { if (serviceClient == null) { throw new ArgumentNullException(nameof(serviceClient)); } this.serviceClient = serviceClient; this.defaultConverter = new JsonDataConverter(); }
private readonly OrchestrationClientAttribute attribute; // for rehydrating a Client after a webhook internal DurableOrchestrationClient( IOrchestrationServiceClient serviceClient, DurableTaskExtension config, OrchestrationClientAttribute attribute) { this.config = config ?? throw new ArgumentNullException(nameof(config)); this.client = new TaskHubClient(serviceClient); this.traceHelper = config.TraceHelper; this.hubName = attribute.TaskHub ?? config.Options.HubName; this.attribute = attribute; }
private readonly OrchestrationClientAttribute attribute; // for rehydrating a Client after a webhook internal DurableOrchestrationClient( IOrchestrationServiceClient serviceClient, DurableTaskExtension config, OrchestrationClientAttribute attribute, EndToEndTraceHelper traceHelper) { this.client = new TaskHubClient(serviceClient); this.traceHelper = traceHelper; this.config = config; this.hubName = config.HubName; this.attribute = attribute; }
public WaitDependsOnWorker( IOrchestrationServiceClient orchestrationServiceClient, IOptions <ARMOrchestrationOptions> options) { this.options = options?.Value; this.taskHubClient = new TaskHubClient(orchestrationServiceClient); this.fetchCommandString = string.Format(fetchCommandTemplate, this.options.Database.WaitDependsOnTableName, this.options.Database.DeploymentOperationsTableName, (int)ProvisioningStage.Successed); this.removeCommandString = string.Format(removeCommandTemplate, this.options.Database.WaitDependsOnTableName); }
public GrpcServerOrchestrationService( IOptions <GrpcServerOrchestrationServiceOptions> options, IOrchestrationService orchestrationService, IOrchestrationServiceClient orchestrationServiceClient, ILogger <GrpcServerOrchestrationService> logger, IExtendedOrchestrationService extendedOrchestrationService = null, IExtendedOrchestrationServiceClient extendedOrchestrationServiceClient = null) { _options = options.Value; _orchestrationService = orchestrationService; _orchestrationServiceClient = orchestrationServiceClient; _logger = logger; _extendedOrchestrationService = extendedOrchestrationService; _extendedOrchestrationServiceClient = extendedOrchestrationServiceClient; }
private IDurableOrchestrationClient GetDurableClient(IOrchestrationServiceClient orchestrationServiceClientMockObject) { var storageProvider = new DurabilityProvider("test", new Mock <IOrchestrationService>().Object, orchestrationServiceClientMockObject, "test"); DurableClientOptions durableClientOptions = new DurableClientOptions { ConnectionName = "Storage", TaskHub = "TestTaskHub", }; DurableTaskOptions durableTaskOptions = new DurableTaskOptions(); DurableClientAttribute attribute = new DurableClientAttribute(durableClientOptions); MessagePayloadDataConverter messagePayloadDataConverter = new MessagePayloadDataConverter(new JsonSerializerSettings(), true); var traceHelper = new EndToEndTraceHelper(new NullLogger <EndToEndTraceHelper>(), durableTaskOptions.Tracing.TraceReplayEvents); var durableOrchestrationClient = (IDurableOrchestrationClient) new DurableClient(storageProvider, null, attribute, messagePayloadDataConverter, traceHelper, durableTaskOptions); return(durableOrchestrationClient); }
/// <summary> /// Creates the instance of the host. /// </summary> /// <param name="orchestrationService"></param> /// <param name="orchestrationClient"></param> /// <param name="instanceStore"></param> /// <param name="resetHub"></param> /// <param name="loggerFactory"></param> /// <param name="scopes">List of scopes, which will be appended to logger scopes, every time</param> public ServiceHost(IOrchestrationService orchestrationService, IOrchestrationServiceClient orchestrationClient, IOrchestrationServiceInstanceStore instanceStore, bool resetHub = false, ILoggerFactory loggerFactory = null) { m_HubClient = new TaskHubClient(orchestrationClient); this.m_TaskHubWorker = new TaskHubWorker(orchestrationService); this.m_InstanceStoreService = instanceStore; if (loggerFactory != null) { m_LoggerFactory = loggerFactory; m_Logger = m_LoggerFactory.CreateLogger <ServiceHost>(); } if (resetHub) { orchestrationService.DeleteAsync().Wait(); } int n = 10; while (--n > 0) { try { orchestrationService.CreateIfNotExistsAsync().Wait(); break; } catch (AggregateException aggEx) { if (n <= 0) { throw; } if (aggEx.InnerException.Message.Contains("409")) { Thread.Sleep(10000); } } } }
private static TaskHubClient ClientFactory(ITaskHubWorkerBuilder builder, IServiceProvider serviceProvider) { IOrchestrationServiceClient client = serviceProvider.GetService <IOrchestrationServiceClient>(); if (client is null) { #pragma warning disable CS0618 // Type or member is obsolete IOrchestrationService service = builder.OrchestrationService ?? serviceProvider.GetRequiredService <IOrchestrationService>(); #pragma warning restore CS0618 // Type or member is obsolete client = service as IOrchestrationServiceClient; if (client is null) { throw new InvalidOperationException( Strings.NotOrchestrationServiceClient(service.GetType())); } } ILoggerFactory loggerFactory = serviceProvider.GetRequiredService <ILoggerFactory>(); return(new TaskHubClient(client, loggerFactory: loggerFactory)); }
/// <summary> /// Creates the instance of ServiceClient, which can be used to act with microservice. /// </summary> /// <param name="sbConnStr"></param> /// <param name="storageConnStr"></param> /// <param name="hubName"></param> public ServiceClient(IOrchestrationServiceClient orchestrationClient) { this.m_HubClient = new TaskHubClient(orchestrationClient); }
public LocalOrchestrationServiceClient(IOrchestrationServiceClient orchestrationServiceClient) { this.OrchestrationServiceClient = orchestrationServiceClient; }
/// <summary> /// Create a new TaskHubClient with the given OrchestrationServiceClient, JsonDataConverter, and ILoggerFactory. /// </summary> /// <param name="serviceClient">Object implementing the <see cref="IOrchestrationServiceClient"/> interface </param> /// <param name="dataConverter">The <see cref="DataConverter"/> to use for message serialization.</param> /// <param name="loggerFactory">The <see cref="ILoggerFactory"/> to use for logging.</param> public TaskHubClient(IOrchestrationServiceClient serviceClient, DataConverter dataConverter = null, ILoggerFactory loggerFactory = null) { this.ServiceClient = serviceClient ?? throw new ArgumentNullException(nameof(serviceClient)); this.defaultConverter = dataConverter ?? new JsonDataConverter(); this.logHelper = new LogHelper(loggerFactory?.CreateLogger("DurableTask.Core")); }
/// <summary> /// Create a new TaskHubClient with the given OrchestrationServiceClient and JsonDataConverter. /// </summary> /// <param name="serviceClient">Object implementing the <see cref="IOrchestrationServiceClient"/> interface </param> /// <param name="dataConverter">The <see cref="JsonDataConverter"/> to use for message serialization.</param> public TaskHubClient(IOrchestrationServiceClient serviceClient, JsonDataConverter dataConverter) : this(serviceClient, dataConverter, null) { }
/// <summary> /// Create a new TaskHubClient with the given OrchestrationServiceClient /// </summary> /// <param name="serviceClient">Object implementing the <see cref="IOrchestrationServiceClient"/> interface </param> public TaskHubClient(IOrchestrationServiceClient serviceClient) : this(serviceClient, new JsonDataConverter()) { }
/// <summary> /// Create a new TaskHubClient with the given OrchestrationServiceClient and JsonDataConverter. /// </summary> /// <param name="serviceClient">Object implementing the <see cref="IOrchestrationServiceClient"/> interface </param> /// <param name="dataConverter">The <see cref="JsonDataConverter"/> to use for message serialization.</param> public TaskHubClient(IOrchestrationServiceClient serviceClient, JsonDataConverter dataConverter) { ServiceClient = serviceClient ?? throw new ArgumentNullException(nameof(serviceClient)); this.defaultConverter = dataConverter ?? throw new ArgumentNullException(nameof(dataConverter)); }
/// <summary> /// Create a new TaskHubClient with the given OrchestrationServiceClient /// </summary> /// <param name="serviceClient">Object implementing the <see cref="IOrchestrationServiceClient"/> interface </param> public TaskHubClient(IOrchestrationServiceClient serviceClient) : this(serviceClient, JsonDataConverter.Default) { }
internal DurableOrchestrationClientMock(IOrchestrationServiceClient serviceClient, DurableTaskExtension config, OrchestrationClientAttribute attribute) : base(serviceClient, config, attribute) { }
/// <summary> /// Creates an instance of FabricOrchestrationServiceController for given OrchestrationServiceClient /// </summary> /// <param name="orchestrationServiceClient">IOrchestrationServiceClient instance</param> public FabricOrchestrationServiceController(IOrchestrationServiceClient orchestrationServiceClient) { this.orchestrationServiceClient = orchestrationServiceClient; }
internal DurableOrchestrationClientMock(IOrchestrationServiceClient serviceClient, DurableTaskExtension config, OrchestrationClientAttribute attribute, EndToEndTraceHelper traceHelper) : base(serviceClient, config, attribute, traceHelper) { }