コード例 #1
0
        public async Task GetInstances(string connectionStringKey, string taskHubName, DateTime createdTimeFrom, DateTime createdTimeTo, IEnumerable <OrchestrationStatus> statuses, int top, string continuationToken)
        {
            Initialize(out _orchestrationService, out _client, connectionStringKey, taskHubName);

            DurableStatusQueryResult queryResult = await _orchestrationService.GetOrchestrationStateAsync(createdTimeFrom, createdTimeTo, statuses, top, continuationToken);

            // TODO? Status of each instance prints as an integer, rather than the string of the OrchestrationStatus enum
            ColoredConsole.WriteLine(JsonConvert.SerializeObject(queryResult.OrchestrationState, Formatting.Indented));

            ColoredConsole.WriteLine(Green($"Continuation token for next set of results: '{queryResult.ContinuationToken}'"));
        }
コード例 #2
0
        public async Task <IList <OrchestrationState> > GetStateAsync(string instanceId)
        {
            Trace.TraceInformation($"Getting orchestration state with instance id - {this.instanceId}");
            // The GetStateAsync only exists in the service object
            AzureStorageOrchestrationService service = (AzureStorageOrchestrationService)this.client.ServiceClient;

            return(await service.GetOrchestrationStateAsync(instanceId, true));
        }
コード例 #3
0
        public async Task <IList <OrchestrationState> > GetAllOrchestrationInstancesAsync()
        {
            // This API currently only exists in the service object and is not yet exposed on the TaskHubClient
            AzureStorageOrchestrationService service   = (AzureStorageOrchestrationService)this.client.ServiceClient;
            IList <OrchestrationState>       instances = await service.GetOrchestrationStateAsync();

            Trace.TraceInformation($"Found {instances.Count} in the task hub instance store.");
            return(instances);
        }
コード例 #4
0
        /// <inheritdoc />
        public override async Task <IList <DurableOrchestrationStatus> > GetStatusAsync(DateTime createdTimeFrom, DateTime?createdTimeTo, IEnumerable <OrchestrationRuntimeStatus> runtimeStatus, CancellationToken cancellationToken = default(CancellationToken))
        {
            // TODO this cast is to avoid to change DurableTask.Core. Change it to use TaskHubClient.
            AzureStorageOrchestrationService serviceClient = (AzureStorageOrchestrationService)this.client.ServiceClient;
            IList <OrchestrationState>       states        = await serviceClient.GetOrchestrationStateAsync(createdTimeFrom, createdTimeTo, runtimeStatus.Select(x => (OrchestrationStatus)x), cancellationToken);

            var results = new List <DurableOrchestrationStatus>();

            foreach (OrchestrationState state in states)
            {
                results.Add(this.ConvertFrom(state));
            }

            return(results);
        }
コード例 #5
0
        /// <inheritdoc />
        public override async Task <IList <DurableOrchestrationStatus> > GetStatusAsync(CancellationToken cancellationToken = default(CancellationToken))
        {
            // TODO this cast is to avoid to change DurableTask.Core. Change it to use TaskHubClient.
            AzureStorageOrchestrationService serviceClient = (AzureStorageOrchestrationService)this.client.ServiceClient;
            IList <OrchestrationState>       states        = await serviceClient.GetOrchestrationStateAsync(cancellationToken);

            var results = new List <DurableOrchestrationStatus>();

            foreach (OrchestrationState state in states)
            {
                results.Add(this.ConvertFrom(state));
            }

            return(results);
        }
        public async Task <OrchestrationQueryResult> GetOrchestrationsAsync(
            OrchestrationQuery query,
            CancellationToken cancellationToken = default)
        {
            var queryCondition = new OrchestrationInstanceStatusQueryCondition
            {
                InstanceIdPrefix = query.InstanceId,
                CreatedTimeFrom  = query.CreatedTimeFrom ?? default,
                CreatedTimeTo    = query.CreatedTimeTo ?? default,
                RuntimeStatus    = query.RuntimeStatus
            };

            var azureQueryResult = await _azureStorageOrchestrationService.GetOrchestrationStateAsync(queryCondition, query.Top, query.ContinuationToken);

            var queryResult = new OrchestrationQueryResult
            {
                Orchestrations    = azureQueryResult.OrchestrationState.ToArray(),
                ContinuationToken = azureQueryResult.ContinuationToken,
            };

            return(queryResult);
        }