Container for the parameters to the ChangeMessageVisibility operation. Changes the visibility timeout of a specified message in a queue to a new value. The maximum allowed timeout value is 12 hours. Thus, you can't extend the timeout of a message in an existing queue to more than a total visibility timeout of 12 hours. For more information, see Visibility Timeout in the Amazon SQS Developer Guide.

For example, you have a message and with the default visibility timeout of 5 minutes. After 3 minutes, you call ChangeMessageVisiblity with a timeout of 10 minutes. At that time, the timeout for the message is extended by 10 minutes beyond the time of the ChangeMessageVisibility action. This results in a total visibility timeout of 13 minutes. You can continue to call the ChangeMessageVisibility to extend the visibility timeout to a maximum of 12 hours. If you try to extend the visibility timeout beyond 12 hours, your request is rejected.

A message is considered to be in flight after it's received from a queue by a consumer, but not yet deleted from the queue.

For standard queues, there can be a maximum of 120,000 inflight messages per queue. If you reach this limit, Amazon SQS returns the OverLimit error message. To avoid reaching the limit, you should delete messages from the queue after they're processed. You can also increase the number of queues you use to process your messages.

For FIFO queues, there can be a maximum of 20,000 inflight messages per queue. If you reach this limit, Amazon SQS returns no error messages.

If you attempt to set the VisibilityTimeout to a value greater than the maximum time left, Amazon SQS returns an error. Amazon SQS doesn't automatically recalculate and increase the timeout to the maximum remaining time.

Unlike with a queue, when you change the visibility timeout for a specific message the timeout value is applied immediately but isn't saved in memory for that message. If you don't delete a message after it is received, the visibility timeout for the message reverts to the original timeout value (not to the value you set using the ChangeMessageVisibility action) the next time the message is received.

Inheritance: AmazonSQSRequest
        public ChangeMessageVisibilityResponse ChangeMessageVisibility(ChangeMessageVisibilityRequest request)
        {
            var q = GetQueue(request.QueueUrl);

            var success = q.ChangeVisibility(request);

            return new ChangeMessageVisibilityResponse();
        }
        public bool ChangeVisibility(ChangeMessageVisibilityRequest request)
        {
            if (request == null)
                return false;

            var response = SqsClient.ChangeMessageVisibility(request);
            return response != null;
        }
        public bool ChangeVisibility(ChangeMessageVisibilityRequest request)
        {
            if (request == null)
            {
                return false;
            }

            cvBuffer.Enqueue(request);
            return CvEnqueued(queueDefinition.ChangeVisibilityBufferSize);
        }
Exemple #4
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.SQS.Model.ChangeMessageVisibilityRequest();

            if (cmdletContext.QueueUrl != null)
            {
                request.QueueUrl = cmdletContext.QueueUrl;
            }
            if (cmdletContext.ReceiptHandle != null)
            {
                request.ReceiptHandle = cmdletContext.ReceiptHandle;
            }
            if (cmdletContext.VisibilityTimeout != null)
            {
                request.VisibilityTimeout = cmdletContext.VisibilityTimeout.Value;
            }

            CmdletOutput output;

            // issue call
            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            try
            {
                var    response       = CallAWSServiceOperation(client, request);
                object pipelineOutput = null;
                pipelineOutput = cmdletContext.Select(response, this);
                output         = new CmdletOutput
                {
                    PipelineOutput  = pipelineOutput,
                    ServiceResponse = response
                };
            }
            catch (Exception e)
            {
                output = new CmdletOutput {
                    ErrorResponse = e
                };
            }

            return(output);
        }
        public bool ChangeVisibility(ChangeMessageVisibilityRequest request)
        {
            if (request.ReceiptHandle.Equals(FakeBatchItemFailString, StringComparison.InvariantCultureIgnoreCase))
            {
                return false;
            }

            var item = GetInFlightItem(request.ReceiptHandle);

            if (request.VisibilityTimeout <= 0)
            {
                RequeueInFlightMessage(request.ReceiptHandle, force: true);
            }
            else
            {
                item.InFlightUntil = item.InFlightUntil += request.VisibilityTimeout;
            }

            return true;
        }
 /// <summary>
 /// Changes the visibility      timeout of a specified message in a queue to a new value.
 /// The maximum allowed      timeout value you can set the value to is 12 hours. This
 /// means you can't extend      the timeout of a message in an existing queue to more
 /// than a total visibility      timeout of 12 hours. (For more information visibility
 /// timeout, see <a href="http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html">Visibility
 ///        Timeout</a> in the <i>Amazon SQS Developer Guide</i>.)
 /// 
 ///     
 /// <para>
 /// For example, let's say you have a message and its default message visibility     
 /// timeout is 30 minutes. You could call <code>ChangeMessageVisiblity</code> with   
 ///   a value of two hours and the effective timeout would be two hours and 30      minutes.
 /// When that time comes near you could again extend the time out by      calling ChangeMessageVisiblity,
 /// but this time the maximum allowed timeout would      be 9 hours and 30 minutes.
 /// </para>
 ///         <note>
 /// <para>
 /// There is a 120,000 limit for the number of inflight messages per queue. Messages are
 /// inflight after they have been received from the queue by a consuming component, but
 /// have not yet been deleted from the queue. If you reach the 120,000 limit, you will
 /// receive an OverLimit error message from Amazon SQS. To help avoid reaching the limit,
 /// you should       delete the messages from the queue after they have been processed.
 /// You can also increase the number of queues you use to process the messages.    
 /// </para>
 /// </note>    <important>If you attempt to set the <code>VisibilityTimeout</code> to
 /// an      amount more than the maximum time left, Amazon SQS returns an error. It will
 ///      not automatically recalculate and increase the timeout to the maximum time  
 ///    remaining.</important>    <important>Unlike with a queue, when you change the visibility
 /// timeout for a      specific message, that timeout value is applied immediately but
 /// is not saved in      memory for that message. If you don't delete a message after
 /// it is received,      the visibility timeout for the message the next time it is received
 /// reverts to      the original timeout value, not the value you set with the      <code>ChangeMessageVisibility</code>
 /// action.</important>
 /// </summary>
 /// <param name="queueUrl">The URL of the Amazon SQS queue to take action on.</param>
 /// <param name="receiptHandle">The receipt handle associated with the message whose visibility timeout   should be changed. This parameter is returned by the <a>ReceiveMessage</a> action.</param>
 /// <param name="visibilityTimeout">The new value (in seconds - from 0 to 43200 - maximum 12 hours) for the message's visibility timeout.</param>
 /// 
 /// <returns>The response from the ChangeMessageVisibility service method, as returned by SQS.</returns>
 /// <exception cref="MessageNotInflightException">
 /// The message referred to is not in flight.
 /// </exception>
 /// <exception cref="ReceiptHandleIsInvalidException">
 /// The receipt handle provided is not valid.
 /// </exception>
 public ChangeMessageVisibilityResponse ChangeMessageVisibility(string queueUrl, string receiptHandle, int visibilityTimeout)
 {
     var request = new ChangeMessageVisibilityRequest();
     request.QueueUrl = queueUrl;
     request.ReceiptHandle = receiptHandle;
     request.VisibilityTimeout = visibilityTimeout;
     return ChangeMessageVisibility(request);
 }
Exemple #7
0
        /// <summary>
        /// Initiates the asynchronous execution of the ChangeMessageVisibility operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the ChangeMessageVisibility 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<ChangeMessageVisibilityResponse> ChangeMessageVisibilityAsync(ChangeMessageVisibilityRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new ChangeMessageVisibilityRequestMarshaller();
            var unmarshaller = ChangeMessageVisibilityResponseUnmarshaller.Instance;

            return InvokeAsync<ChangeMessageVisibilityRequest,ChangeMessageVisibilityResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
Exemple #8
0
 /// <summary>
 /// Changes the visibility timeout of a specified message in a queue to a new value. The
 /// maximum allowed timeout value is 12 hours. Thus, you can't extend the timeout of a
 /// message in an existing queue to more than a total visibility timeout of 12 hours.
 /// For more information, see <a href="http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html">Visibility
 /// Timeout</a> in the <i>Amazon SQS Developer Guide</i>.
 /// 
 ///  
 /// <para>
 /// For example, you have a message and with the default visibility timeout of 5 minutes.
 /// After 3 minutes, you call <code>ChangeMessageVisiblity</code> with a timeout of 10
 /// minutes. At that time, the timeout for the message is extended by 10 minutes beyond
 /// the time of the <code>ChangeMessageVisibility</code> action. This results in a total
 /// visibility timeout of 13 minutes. You can continue to call the <code>ChangeMessageVisibility</code>
 /// to extend the visibility timeout to a maximum of 12 hours. If you try to extend the
 /// visibility timeout beyond 12 hours, your request is rejected.
 /// </para>
 ///  
 /// <para>
 /// A message is considered to be <i>in flight</i> after it's received from a queue by
 /// a consumer, but not yet deleted from the queue.
 /// </para>
 ///  
 /// <para>
 /// For standard queues, there can be a maximum of 120,000 inflight messages per queue.
 /// If you reach this limit, Amazon SQS returns the <code>OverLimit</code> error message.
 /// To avoid reaching the limit, you should delete messages from the queue after they're
 /// processed. You can also increase the number of queues you use to process your messages.
 /// </para>
 ///  
 /// <para>
 /// For FIFO queues, there can be a maximum of 20,000 inflight messages per queue. If
 /// you reach this limit, Amazon SQS returns no error messages.
 /// </para>
 ///  <important> 
 /// <para>
 /// If you attempt to set the <code>VisibilityTimeout</code> to a value greater than the
 /// maximum time left, Amazon SQS returns an error. Amazon SQS doesn't automatically recalculate
 /// and increase the timeout to the maximum remaining time.
 /// </para>
 ///  
 /// <para>
 /// Unlike with a queue, when you change the visibility timeout for a specific message
 /// the timeout value is applied immediately but isn't saved in memory for that message.
 /// If you don't delete a message after it is received, the visibility timeout for the
 /// message reverts to the original timeout value (not to the value you set using the
 /// <code>ChangeMessageVisibility</code> action) the next time the message is received.
 /// </para>
 ///  </important>
 /// </summary>
 /// <param name="queueUrl">The URL of the Amazon SQS queue whose message's visibility is changed. Queue URLs are case-sensitive.</param>
 /// <param name="receiptHandle">The receipt handle associated with the message whose visibility timeout is changed. This parameter is returned by the <code> <a>ReceiveMessage</a> </code> action.</param>
 /// <param name="visibilityTimeout">The new value for the message's visibility timeout (in seconds). Values values: <code>0</code> to <code>43200</code>. Maximum: 12 hours.</param>
 /// <param name="cancellationToken">
 ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
 /// </param>
 /// 
 /// <returns>The response from the ChangeMessageVisibility service method, as returned by SQS.</returns>
 /// <exception cref="Amazon.SQS.Model.MessageNotInflightException">
 /// The message referred to isn't in flight.
 /// </exception>
 /// <exception cref="Amazon.SQS.Model.ReceiptHandleIsInvalidException">
 /// The receipt handle provided isn't valid.
 /// </exception>
 public Task<ChangeMessageVisibilityResponse> ChangeMessageVisibilityAsync(string queueUrl, string receiptHandle, int visibilityTimeout, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
 {
     var request = new ChangeMessageVisibilityRequest();
     request.QueueUrl = queueUrl;
     request.ReceiptHandle = receiptHandle;
     request.VisibilityTimeout = visibilityTimeout;
     return ChangeMessageVisibilityAsync(request, cancellationToken);
 }
 IAsyncResult invokeChangeMessageVisibility(ChangeMessageVisibilityRequest changeMessageVisibilityRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new ChangeMessageVisibilityRequestMarshaller().Marshall(changeMessageVisibilityRequest);
     var unmarshaller = ChangeMessageVisibilityResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
 /// <summary>
 /// Initiates the asynchronous execution of the ChangeMessageVisibility operation.
 /// <seealso cref="Amazon.SQS.IAmazonSQS.ChangeMessageVisibility"/>
 /// </summary>
 /// 
 /// <param name="changeMessageVisibilityRequest">Container for the necessary parameters to execute the ChangeMessageVisibility operation on
 ///          AmazonSQS.</param>
 /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
 /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 public IAsyncResult BeginChangeMessageVisibility(ChangeMessageVisibilityRequest changeMessageVisibilityRequest, AsyncCallback callback, object state)
 {
     return invokeChangeMessageVisibility(changeMessageVisibilityRequest, callback, state, false);
 }
        IAsyncResult invokeChangeMessageVisibility(ChangeMessageVisibilityRequest request, AsyncCallback callback, object state, bool synchronized)
        {
            var marshaller = new ChangeMessageVisibilityRequestMarshaller();
            var unmarshaller = ChangeMessageVisibilityResponseUnmarshaller.Instance;

            return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer);
        }
		internal ChangeMessageVisibilityResponse ChangeMessageVisibility(ChangeMessageVisibilityRequest request)
        {
            var task = ChangeMessageVisibilityAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
        /// <summary>
        /// Initiates the asynchronous execution of the ChangeMessageVisibility operation.
        /// <seealso cref="Amazon.SQS.IAmazonSQS.ChangeMessageVisibility"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the ChangeMessageVisibility 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 async Task<ChangeMessageVisibilityResponse> ChangeMessageVisibilityAsync(ChangeMessageVisibilityRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new ChangeMessageVisibilityRequestMarshaller();
            var unmarshaller = ChangeMessageVisibilityResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, ChangeMessageVisibilityRequest, ChangeMessageVisibilityResponse>(request, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
        /// <summary>
        /// Changes the visibility      timeout of a specified message in a queue to a new value.
        /// The maximum allowed      timeout value you can set the value to is 12 hours. This
        /// means you can't extend      the timeout of a message in an existing queue to more
        /// than a total visibility      timeout of 12 hours. (For more information visibility
        /// timeout, see <a href="http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html">Visibility
        ///        Timeout</a> in the <i>Amazon SQS Developer Guide</i>.)
        /// 
        ///     
        /// <para>
        /// For example, let's say you have a message and its default message visibility     
        /// timeout is 30 minutes. You could call <code>ChangeMessageVisiblity</code> with   
        ///   a value of two hours and the effective timeout would be two hours and 30      minutes.
        /// When that time comes near you could again extend the time out by      calling ChangeMessageVisiblity,
        /// but this time the maximum allowed timeout would      be 9 hours and 30 minutes.
        /// </para>
        ///         <note>
        /// <para>
        /// There is a 120,000 limit for the number of inflight messages per queue. Messages are
        /// inflight after they have been received from the queue by a consuming component, but
        /// have not yet been deleted from the queue. If you reach the 120,000 limit, you will
        /// receive an OverLimit error message from Amazon SQS. To help avoid reaching the limit,
        /// you should       delete the messages from the queue after they have been processed.
        /// You can also increase the number of queues you use to process the messages.    
        /// </para>
        /// </note>    <important>If you attempt to set the <code>VisibilityTimeout</code> to
        /// an      amount more than the maximum time left, Amazon SQS returns an error. It will
        ///      not automatically recalculate and increase the timeout to the maximum time  
        ///    remaining.</important>    <important>Unlike with a queue, when you change the visibility
        /// timeout for a      specific message, that timeout value is applied immediately but
        /// is not saved in      memory for that message. If you don't delete a message after
        /// it is received,      the visibility timeout for the message the next time it is received
        /// reverts to      the original timeout value, not the value you set with the      <code>ChangeMessageVisibility</code>
        /// action.</important>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the ChangeMessageVisibility service method.</param>
        /// 
        /// <returns>The response from the ChangeMessageVisibility service method, as returned by SQS.</returns>
        /// <exception cref="MessageNotInflightException">
        /// The message referred to is not in flight.
        /// </exception>
        /// <exception cref="ReceiptHandleIsInvalidException">
        /// The receipt handle provided is not valid.
        /// </exception>
        public ChangeMessageVisibilityResponse ChangeMessageVisibility(ChangeMessageVisibilityRequest request)
        {
            var marshaller = new ChangeMessageVisibilityRequestMarshaller();
            var unmarshaller = ChangeMessageVisibilityResponseUnmarshaller.Instance;

            return Invoke<ChangeMessageVisibilityRequest,ChangeMessageVisibilityResponse>(request, marshaller, unmarshaller);
        }
 public Task<ChangeMessageVisibilityResponse> ChangeMessageVisibilityAsync(ChangeMessageVisibilityRequest request, CancellationToken cancellationToken = new CancellationToken())
 {
     throw new NotImplementedException();
 }
Exemple #16
0
    public static void SQSChangeMessageVisibility()
    {
      #region SQSChangeMessageVisibility
      var client = new AmazonSQSClient();

      var url = "https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyTestQueue";

      // Receive messages.
      var rcvRequest = new ReceiveMessageRequest
      {
        AttributeNames = new List<string>() { "All" },
        QueueUrl = url
      };

      var rcvResponse = client.ReceiveMessage(rcvRequest);

      // Change visibility timeout for each message.
      if (rcvResponse.Messages.Count > 0)
      {
        foreach (var message in rcvResponse.Messages)
        {
          var visRequest = new ChangeMessageVisibilityRequest
          {
            QueueUrl = url,
            ReceiptHandle = message.ReceiptHandle,
            VisibilityTimeout = (int)TimeSpan.FromMinutes(10).TotalSeconds
          };

          client.ChangeMessageVisibility(visRequest);
        }
      }
      else
      {
        Console.WriteLine("No messages to change visibility for.");
      }
      #endregion
    }
 /// <summary>
 /// Initiates the asynchronous execution of the ChangeMessageVisibility operation.
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the ChangeMessageVisibility operation on AmazonSQSClient.</param>
 /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
 /// <param name="options">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 public void ChangeMessageVisibilityAsync(ChangeMessageVisibilityRequest request, AmazonServiceCallback<ChangeMessageVisibilityRequest, ChangeMessageVisibilityResponse> callback, AsyncOptions options = null)
 {
     options = options == null?new AsyncOptions():options;
     var marshaller = new ChangeMessageVisibilityRequestMarshaller();
     var unmarshaller = ChangeMessageVisibilityResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<ChangeMessageVisibilityRequest,ChangeMessageVisibilityResponse> responseObject 
                     = new AmazonServiceResult<ChangeMessageVisibilityRequest,ChangeMessageVisibilityResponse>((ChangeMessageVisibilityRequest)req, (ChangeMessageVisibilityResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<ChangeMessageVisibilityRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
 /// <summary>
 /// Changes the visibility timeout of a specified message in a queue to a new value. The
 /// maximum allowed timeout value you can set the value to is 12 hours. This means you
 /// can't extend the timeout of a message in an existing queue to more than a total visibility
 /// timeout of 12 hours. (For more information visibility timeout, see <a href="http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html">Visibility
 /// Timeout</a> in the <i>Amazon SQS Developer Guide</i>.)
 /// 
 ///  
 /// <para>
 /// For example, let's say you have a message and its default message visibility timeout
 /// is 30 minutes. You could call <code>ChangeMessageVisiblity</code> with a value of
 /// two hours and the effective timeout would be two hours and 30 minutes. When that time
 /// comes near you could again extend the time out by calling ChangeMessageVisiblity,
 /// but this time the maximum allowed timeout would be 9 hours and 30 minutes.
 /// </para>
 ///  <note>
 /// <para>
 /// There is a 120,000 limit for the number of inflight messages per queue. Messages are
 /// inflight after they have been received from the queue by a consuming component, but
 /// have not yet been deleted from the queue. If you reach the 120,000 limit, you will
 /// receive an OverLimit error message from Amazon SQS. To help avoid reaching the limit,
 /// you should delete the messages from the queue after they have been processed. You
 /// can also increase the number of queues you use to process the messages. 
 /// </para>
 /// </note> <important>If you attempt to set the <code>VisibilityTimeout</code> to an
 /// amount more than the maximum time left, Amazon SQS returns an error. It will not automatically
 /// recalculate and increase the timeout to the maximum time remaining.</important> <important>Unlike
 /// with a queue, when you change the visibility timeout for a specific message, that
 /// timeout value is applied immediately but is not saved in memory for that message.
 /// If you don't delete a message after it is received, the visibility timeout for the
 /// message the next time it is received reverts to the original timeout value, not the
 /// value you set with the <code>ChangeMessageVisibility</code> action.</important>
 /// </summary>
 /// <param name="queueUrl">The URL of the Amazon SQS queue to take action on.</param>
 /// <param name="receiptHandle">The receipt handle associated with the message whose visibility timeout should be changed. This parameter is returned by the <a>ReceiveMessage</a> action.</param>
 /// <param name="visibilityTimeout">The new value (in seconds - from 0 to 43200 - maximum 12 hours) for the message's visibility timeout.</param>
 /// <param name="options">
  ///     A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
  ///     procedure using the AsyncState property.
  /// </param>
 /// 
 /// <returns>The response from the ChangeMessageVisibility service method, as returned by SQS.</returns>
 /// <exception cref="Amazon.SQS.Model.MessageNotInflightException">
 /// The message referred to is not in flight.
 /// </exception>
 /// <exception cref="Amazon.SQS.Model.ReceiptHandleIsInvalidException">
 /// The receipt handle provided is not valid.
 /// </exception>
 public void ChangeMessageVisibilityAsync(string queueUrl, string receiptHandle, int visibilityTimeout,  AmazonServiceCallback<ChangeMessageVisibilityRequest, ChangeMessageVisibilityResponse> callback, AsyncOptions options = null)
 {
     var request = new ChangeMessageVisibilityRequest();
     request.QueueUrl = queueUrl;
     request.ReceiptHandle = receiptHandle;
     request.VisibilityTimeout = visibilityTimeout;
     ChangeMessageVisibilityAsync(request, callback, options);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the ChangeMessageVisibility operation.
        /// <seealso cref="Amazon.SQS.IAmazonSQS"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the ChangeMessageVisibility operation on AmazonSQSClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndChangeMessageVisibility
        ///         operation.</returns>
        public IAsyncResult BeginChangeMessageVisibility(ChangeMessageVisibilityRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new ChangeMessageVisibilityRequestMarshaller();
            var unmarshaller = ChangeMessageVisibilityResponseUnmarshaller.Instance;

            return BeginInvoke<ChangeMessageVisibilityRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
Exemple #20
0
 private Amazon.SQS.Model.ChangeMessageVisibilityResponse CallAWSServiceOperation(IAmazonSQS client, Amazon.SQS.Model.ChangeMessageVisibilityRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Simple Queue Service (SQS)", "ChangeMessageVisibility");
     try
     {
         #if DESKTOP
         return(client.ChangeMessageVisibility(request));
         #elif CORECLR
         return(client.ChangeMessageVisibilityAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }
        /// <summary>
        /// <para>Changes the visibility timeout of a specified message in a queue to a new value. The maximum allowed timeout value you can set the
        /// value to is 12 hours. This means you can't extend the timeout of a message in an existing queue to more than a total visibility timeout of
        /// 12 hours. (For more information visibility timeout, see <a href="http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html">Visibility Timeout</a> in the <i>Amazon SQS
        /// Developer Guide</i> .)</para> <para>For example, let's say you have a message and its default message visibility timeout is 30 minutes. You
        /// could call <c>ChangeMessageVisiblity</c> with a value of two hours and the effective timeout would be two hours and 30 minutes. When that
        /// time comes near you could again extend the time out by calling ChangeMessageVisiblity, but this time the maximum allowed timeout would be 9
        /// hours and 30 minutes.</para> <para><b>IMPORTANT:</b>If you attempt to set the VisibilityTimeout to an amount more than the maximum time
        /// left, Amazon SQS returns an error. It will not automatically recalculate and increase the timeout to the maximum time remaining.</para>
        /// <para><b>IMPORTANT:</b>Unlike with a queue, when you change the visibility timeout for a specific message, that timeout value is applied
        /// immediately but is not saved in memory for that message. If you don't delete a message after it is received, the visibility timeout for the
        /// message the next time it is received reverts to the original timeout value, not the value you set with the ChangeMessageVisibility
        /// action.</para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the ChangeMessageVisibility service method on
        /// AmazonSQS.</param>
        /// 
        /// <exception cref="T:Amazon.SQS.Model.ReceiptHandleIsInvalidException" />
        /// <exception cref="T:Amazon.SQS.Model.MessageNotInflightException" />
		public ChangeMessageVisibilityResponse ChangeMessageVisibility(ChangeMessageVisibilityRequest request)
        {
            var task = ChangeMessageVisibilityAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
 /// <summary>
 /// <para>The <c>ChangeMessageVisibility</c> action changes the visibility timeout of a specified message in a queue to a new value. The maximum
 /// allowed timeout value you can set the value to is 12 hours. This means you can't extend the timeout of a message in an existing queue to
 /// more than a total visibility timeout of 12 hours. (For more information visibility timeout, see <a
 /// href="http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html" >Visibility Timeout</a> in the Amazon SQS
 /// Developer Guide.)</para> <para>For example, let's say you have a message and its default message visibility timeout is 30 minutes. You could
 /// call <c>ChangeMessageVisiblity</c> with a value of two hours and the effective timeout would be two hours and 30 minutes. When that time
 /// comes near you could again extend the time out by calling ChangeMessageVisiblity, but this time the maximum allowed timeout would be 9 hours
 /// and 30 minutes.</para> <para><b>IMPORTANT:</b>If you attempt to set the VisibilityTimeout to an amount more than the maximum time left,
 /// Amazon SQS returns an error. It will not automatically recalculate and increase the timeout to the maximum time remaining.</para>
 /// <para><b>IMPORTANT:</b>Unlike with a queue, when you change the visibility timeout for a specific message, that timeout value is applied
 /// immediately but is not saved in memory for that message. If you don't delete a message after it is received, the visibility timeout for the
 /// message the next time it is received reverts to the original timeout value, not the value you set with the ChangeMessageVisibility
 /// action.</para>
 /// </summary>
 /// 
 /// <param name="changeMessageVisibilityRequest">Container for the necessary parameters to execute the ChangeMessageVisibility service method on
 ///          AmazonSQS.</param>
 /// 
 /// <exception cref="ReceiptHandleIsInvalidException"/>
 /// <exception cref="MessageNotInflightException"/>
 public ChangeMessageVisibilityResponse ChangeMessageVisibility(ChangeMessageVisibilityRequest changeMessageVisibilityRequest)
 {
     IAsyncResult asyncResult = invokeChangeMessageVisibility(changeMessageVisibilityRequest, null, null, true);
     return EndChangeMessageVisibility(asyncResult);
 }
        /// <summary>
        /// <para>The <c>ChangeMessageVisibility</c> action changes the visibility timeout of a specified message in a queue to a new value. The maximum
        /// allowed timeout value you can set the value to is 12 hours. This means you can't extend the timeout of a message in an existing queue to
        /// more than a total visibility timeout of 12 hours. (For more information visibility timeout, see <a href="http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html">Visibility Timeout</a> in the Amazon SQS
        /// Developer Guide.)</para> <para>For example, let's say you have a message and its default message visibility timeout is 30 minutes. You could
        /// call <c>ChangeMessageVisiblity</c> with a value of two hours and the effective timeout would be two hours and 30 minutes. When that time
        /// comes near you could again extend the time out by calling ChangeMessageVisiblity, but this time the maximum allowed timeout would be 9 hours
        /// and 30 minutes.</para> <para><b>IMPORTANT:</b>If you attempt to set the VisibilityTimeout to an amount more than the maximum time left,
        /// Amazon SQS returns an error. It will not automatically recalculate and increase the timeout to the maximum time remaining.</para>
        /// <para><b>IMPORTANT:</b>Unlike with a queue, when you change the visibility timeout for a specific message, that timeout value is applied
        /// immediately but is not saved in memory for that message. If you don't delete a message after it is received, the visibility timeout for the
        /// message the next time it is received reverts to the original timeout value, not the value you set with the ChangeMessageVisibility
        /// action.</para>
        /// </summary>
        /// 
        /// <param name="changeMessageVisibilityRequest">Container for the necessary parameters to execute the ChangeMessageVisibility service method on
        /// AmazonSQS.</param>
        /// 
        /// <exception cref="T:Amazon.SQS.Model.ReceiptHandleIsInvalidException" />
        /// <exception cref="T:Amazon.SQS.Model.MessageNotInflightException" />
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public Task<ChangeMessageVisibilityResponse> ChangeMessageVisibilityAsync(ChangeMessageVisibilityRequest changeMessageVisibilityRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new ChangeMessageVisibilityRequestMarshaller();
            var unmarshaller = ChangeMessageVisibilityResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, ChangeMessageVisibilityRequest, ChangeMessageVisibilityResponse>(changeMessageVisibilityRequest, marshaller, unmarshaller, signer, cancellationToken);
        }
        /// <summary>
        /// Changes the visibility of a message in an SQS queue.
        /// </summary>
        /// <returns>The change message visibility response.</returns>
        public virtual ChangeMessageVisibilityResponse ChangeMessageVisibility(ChangeMessageVisibilityRequest changeMessageVisibilityRequest)
        {
            if (changeMessageVisibilityRequest == null)
            {
                throw new ArgumentNullException("changeMessageVisibilityRequest");
            }

            // Log.DebugFormat("SqsClient: Changing message visibility in queue: {0}.", changeMessageVisibilityRequest.QueueUrl);
            return this.Client.ChangeMessageVisibility(changeMessageVisibilityRequest);            
        }