Exemple #1
0
        /// <summary>
        /// <para> Task runners call this action to receive a task to perform from AWS Data Pipeline. The task runner specifies which tasks it can
        /// perform by setting a value for the workerGroup parameter of the PollForTask call. The task returned by PollForTask may come from any of the
        /// pipelines that match the workerGroup value passed in by the task runner and that was launched using the IAM user credentials specified by
        /// the task runner. </para> <para> If tasks are ready in the work queue, PollForTask returns a response immediately. If no tasks are available
        /// in the queue, PollForTask uses long-polling and holds on to a poll connection for up to a 90 seconds during which time the first newly
        /// scheduled task is handed to the task runner. To accomodate this, set the socket timeout in your task runner to 90 seconds. The task runner
        /// should not call PollForTask again on the same <c>workerGroup</c> until it receives a response, and this may take up to 90 seconds. </para>
        /// </summary>
        ///
        /// <param name="pollForTaskRequest">Container for the necessary parameters to execute the PollForTask service method on
        /// AmazonDataPipeline.</param>
        ///
        /// <returns>The response from the PollForTask service method, as returned by AmazonDataPipeline.</returns>
        ///
        /// <exception cref="T:Amazon.DataPipeline.Model.InternalServiceErrorException" />
        /// <exception cref="T:Amazon.DataPipeline.Model.InvalidRequestException" />
        /// <exception cref="T:Amazon.DataPipeline.Model.TaskNotFoundException" />
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        public Task <PollForTaskResponse> PollForTaskAsync(PollForTaskRequest pollForTaskRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new PollForTaskRequestMarshaller();
            var unmarshaller = PollForTaskResponseUnmarshaller.GetInstance();

            return(Invoke <IRequest, PollForTaskRequest, PollForTaskResponse>(pollForTaskRequest, marshaller, unmarshaller, signer, cancellationToken));
        }
        internal PollForTaskResponse PollForTask(PollForTaskRequest request)
        {
            var marshaller   = new PollForTaskRequestMarshaller();
            var unmarshaller = PollForTaskResponseUnmarshaller.Instance;

            return(Invoke <PollForTaskRequest, PollForTaskResponse>(request, marshaller, unmarshaller));
        }
        /// <summary>
        /// Initiates the asynchronous execution of the PollForTask operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the PollForTask operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task <PollForTaskResponse> PollForTaskAsync(PollForTaskRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new PollForTaskRequestMarshaller();
            var unmarshaller = PollForTaskResponseUnmarshaller.Instance;

            return(InvokeAsync <PollForTaskRequest, PollForTaskResponse>(request, marshaller,
                                                                         unmarshaller, cancellationToken));
        }
Exemple #4
0
        internal PollForTaskResponse PollForTask(PollForTaskRequest request)
        {
            var task = PollForTaskAsync(request);

            try
            {
                return(task.Result);
            }
            catch (AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return(null);
            }
        }