예제 #1
0
        public async Task <FoxyWorkflowSession> UpdateCommandResult(FoxyWorkflowSession workflowSession)
        {
            using (var client = new DocumentClient(new Uri(
                                                       ConfigurationManager.Repositories.ImagesProcessorCosmosDbEndpointUrl),
                                                   ConfigurationManager.Repositories.ImagesProcessorCosmosDbPrimaryAccessKey))
            {
                var documentResponse = await client.UpsertDocumentAsync(UriFactory
                                                                        .CreateDocumentCollectionUri("ImageProcessor", "WorkflowSessions"), workflowSession);

                return(workflowSession);
            }
        }
        public async Task <FoxyResponse <FoxyWorkflowSession> > StoreSession(FoxyWorkflowSession workflowSession)
        {
            try
            {
                workflowSession = await WorkflowsDbGateway.StoreWorkflowSession(workflowSession);

                return(FoxyResponse <FoxyWorkflowSession> .Success(workflowSession));
            }
            catch (Exception e)
            {
                ErrorReporting.StoreExceptionDetails(e, Guid.Empty);
                return(FoxyResponse <FoxyWorkflowSession> .Failure("There was a problem while storing workflow session"));
            }
        }
예제 #3
0
        public async Task <FoxyWorkflowSession> StoreWorkflowSession(FoxyWorkflowSession workflowSession)
        {
            using (var client = new DocumentClient(new Uri(
                                                       ConfigurationManager.Repositories.ImagesProcessorCosmosDbEndpointUrl),
                                                   ConfigurationManager.Repositories.ImagesProcessorCosmosDbPrimaryAccessKey))
            {
                var documentResponse = await client.CreateDocumentAsync(UriFactory
                                                                        .CreateDocumentCollectionUri("ImageProcessor", "WorkflowSessions"), workflowSession);

                workflowSession.id = Guid.Parse(documentResponse.Resource.Id);

                return(workflowSession);
            }
        }
        public async Task <FoxyResponse <AwaitableCommandResult> > CreateAwaitableCommandResultsInScopeOfSession(FoxyWorkflowSession workflowSession)
        {
            try
            {
                var awaitableCommandResult = AwaitableCommandResult.Create(workflowSession.id);
                workflowSession.AwaitableCommandResults.Add(awaitableCommandResult);

                return(FoxyResponse <AwaitableCommandResult> .Success(awaitableCommandResult));
            }
            catch (Exception e)
            {
                ErrorReporting.StoreExceptionDetails(e, workflowSession.id);
                return(FoxyResponse <AwaitableCommandResult> .Failure("There was a problem while preparing workflow session"));
            }
        }