Ошибка срабатывания функции очереди Azure

Когда функция, срабатывающая в очереди Azure, не срабатывает, когда сообщение станет доступным в очереди для повторной попытки?

Is it:

  • По истечении времени ожидания видимости

or

  • Сразу при неудаче

Failure = функция выдает Exception.


person marius-O    schedule 23.08.2017    source источник


Ответы (2)


Я не могу найти документацию, поэтому, возможно, попросите ее в этом репозитории https://github.com/Azure/azure-webjobs-sdk

но глядя на код здесь должен ответить на ваш вопрос

    /// <summary>
    /// This method completes processing of the specified message, after the job function has been invoked.
    /// </summary>
    /// <remarks>
    /// If the message was processed successfully, the message should be deleted. If message processing failed, the
    /// message should be release back to the queue, or if the maximum dequeue count has been exceeded, the message
    /// should be moved to the poison queue (if poison queue handling is configured for the queue).
    /// </remarks>
    /// <param name="message">The message to complete processing for.</param>
    /// <param name="result">The <see cref="FunctionResult"/> from the job invocation.</param>
    /// <param name="cancellationToken">The <see cref="CancellationToken"/> to use</param>
    /// <returns></returns>
    public virtual async Task CompleteProcessingMessageAsync(CloudQueueMessage message, FunctionResult result, CancellationToken cancellationToken)
    {
        if (result.Succeeded)
        {
            await DeleteMessageAsync(message, cancellationToken);
        }
        else if (_poisonQueue != null)
        {
            if (message.DequeueCount >= MaxDequeueCount)
            {
                // These values may change if the message is inserted into another queue. We'll store them here and make sure
                // the message always has the original values before we pass it to a customer-facing method.
                string id = message.Id;
                string popReceipt = message.PopReceipt;

                await CopyMessageToPoisonQueueAsync(message, _poisonQueue, cancellationToken);

                // TEMP: Re-evaluate these property updates when we update Storage SDK: https://github.com/Azure/azure-webjobs-sdk/issues/1144
                message.UpdateChangedProperties(id, popReceipt);

                await DeleteMessageAsync(message, cancellationToken);
            }
            else
            {
                await ReleaseMessageAsync(message, result, VisibilityTimeout, cancellationToken);
            }
        }
        else
        {
            // For queues without a corresponding poison queue, leave the message invisible when processing
            // fails to prevent a fast infinite loop.
            // Specifically, don't call ReleaseMessage(message)
        }

}

person ahmelsayed    schedule 23.08.2017

Его сразу же заберут снова. Я запустил образец функции, запускаемой из очереди, и она сработала 5 раз в течение нескольких секунд. После 5 попыток элемент был перемещен в очередь xyz-poison.

person Mikhail Shilkov    schedule 23.08.2017
comment
Я не думаю, что у вас есть ссылка на документацию по поведению. Спрашивал из-за stackoverflow.com/a/40011705/1183475, это в октябре 2016 года, и они говорили, что собираюсь заставить их сразу повторить попытку, я тоже сейчас попробую ... - person marius-O; 23.08.2017