Azure Function with queue trigger It is deleting my stored messages in the queue

Fabrício Fortaleza 150 Reputation points
2023-12-08T21:43:19.1166667+00:00

I'm creating an Azure function that should read all messages in the storage queue when they're received. If any message contains a specific parameter that I'll define, the function should send the content of that message to an email. However, when running the default code generated upon creating a new function, it accessed my storage queue (I've already set up the connection) and deleted all the messages that were in the queue. What's happening? Here's the code used.

import azure.functions as func
import logging

app = func.FunctionApp()

@app.queue_trigger(arg_name="azqueue", queue_name="baas-webhooks", connection="AzureWebJobsStorage") 
def NeroWebhooksBaas(azqueue: func.QueueMessage):
    logging.info('Python Queue trigger processed a message: %s',
                azqueue.get_body().decode('utf-8'))
    


Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,146 questions
Azure Queue Storage
Azure Queue Storage
An Azure service that provides messaging queues in the cloud.
108 questions
0 comments No comments
{count} vote

Accepted answer
  1. Claudia Dos Santos Haz (CONCENTRIX CORPORATION) 1,115 Reputation points Microsoft Vendor
    2023-12-11T10:18:28.48+00:00

    Hi @Fabrício Fortaleza,

    Thank you for asking this question on the Q&A Platform.

    We hope this article can be of help to you:

    https://learn.microsoft.com/en-us/azure/azure-functions/recover-python-functions?pivots=python-mode-decorators&tabs=vscode%2Cbash

    Best regards,

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.