Ejemplo n.º 1
0
        /// <summary>
        /// Asynchronously change the visibility timer of a single message. The time when the message will be visible again is calculated from the current time (now) + VisibilityTimer.
        ///
        /// returns 1 if successful, 0 if the message was not found
        /// </summary>
        public async Task <int> ChangeMessageVisibilityAsync(ChangeMessageVisibilityOptions options)
        {
            // todo : validate (qname, id, vt)
            var key = $"{this._options.Namespace}:{options.QueueName}";
            var q   = await this.GetQueue(options.QueueName);

            var res = await _changeMessageVisibility.EvaluateAsync(
                this.RedisClient,
                new
            {
                key      = key,
                id       = options.Id,
                newTimer = q.Timestamp + options.VisibilityTimer * 1000
            }
                );

            return((int)res);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Synchronously change the visibility timer of a single message. The time when the message will be visible again is calculated from the current time (now) + VisibilityTimer.
 ///
 /// returns 1 if successful, 0 if the message was not found
 /// </summary>
 public int ChangeMessageVisibility(ChangeMessageVisibilityOptions options)
 {
     return(ChangeMessageVisibilityAsync(options).ConfigureAwait(false).GetAwaiter().GetResult());
 }