Esempio n. 1
0
        public async Task <string> SubmitJobAsync(TagCloudJob job)
        {
            Console.WriteLine($"Submitting job {job.VideoName}: {job.VideoUrl}");

            var request = new HttpRequestMessage();

            request.RequestUri = new Uri(baseUrl + "api/TagClouds");
            request.Method     = HttpMethod.Post;
            request.Content    = new StringContent(JsonUtil.Serialize(job));
            request.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
            using (var response = await _client.SendAsync(request))
            {
                var id = await response.Content.ReadAsStringAsync();

                Console.WriteLine($"Job id returned: {id}");
                return(id);
            }
        }
        public async Task <string> Post([FromBody] TagCloudJob value)
        {
            var state = new State
            {
                VideoName   = value.VideoName,
                OriginalUrl = value.VideoUrl,
                Id          = Guid.NewGuid().ToString()
            };

            await this._stepClient.StartExecutionAsync(new StartExecutionRequest
            {
                Name            = value.VideoName.Replace(" ", "-") + Guid.NewGuid().ToString(),
                Input           = JsonConvert.SerializeObject(state),
                StateMachineArn = this._stateMachineArn
            });


            return(state.Id);
        }