Select Language:
If you’re using an Azure Function that processes messages from a queue and you want to make those messages available through an API—but without using Durable Functions—you’ll need a simple two-step setup. Since one Azure Function can’t handle both a queue trigger and an HTTP trigger at the same time, separating these functions is the best approach.
First, you keep your existing function that is triggered by the queue. This function will process each message and then save the relevant data to a storage service. You can use options like Azure Table Storage, Blob Storage, or Cosmos DB, depending on your needs. This step ensures your data is stored securely and can be accessed later.
Next, create a new Azure Function with an HTTP trigger. This function acts as your public API endpoint. When someone calls this API, it fetches the processed data from storage and sends it back as a response. This way, your API remains fast and simple, directly reading data from storage without needing to handle queue messages.
This method keeps your system clean and scalable. It also makes it easier to maintain because each function has a clear purpose: one processes messages and saves data, while the other serves data through an API.
For storage, consider using Azure Table Storage or Blob Storage if your data is light and straightforward. If you need more advanced features or want faster queries, Azure Cosmos DB is a good choice.
Your architecture will look like this:
– Queue → Queue-triggered Function → Stores data in Azure Storage
– API Endpoint (HTTP-triggered Function) → Retrieves data from storage → Responds to API calls
This approach helps you keep things simple and scalable without adding the complexity of Durable Functions. If you need any further help or clarification, just ask!