Is there an Azure Function trigger support for Event Grid Namespace Topic?

Philip Leung 20 Reputation points
2024-05-30T04:42:51.3633333+00:00

Hi

There is an EventGridTrigger attribute for Azure Function that can be used to handle custom topic event. I wonder if there is an equivalent for Event Grid Namespace Topic with the pull model event subscription. I cannot find any example online.

What would be the recommended way of consuming these events from the Namespace Topic if Azure function trigger support is not available?

Thanks

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,495 questions
Azure Event Grid
Azure Event Grid
An Azure event routing service designed for high availability, consistent performance, and dynamic scale.
337 questions
{count} votes

Accepted answer
  1. Vlad Costa 615 Reputation points
    2024-05-30T05:13:52.82+00:00

    There isn’t a direct equivalent to the EventGridTrigger attribute for Azure Functions.

    You can use the pull delivery model to consume events from the Namespace Topic. With pull delivery, your application connects to Event Grid to read CloudEvents using queue-like semantics. This allows you to consume events at your own pace, scale, or an ingress rate your application supports.

    Reference: https://learn.microsoft.com/en-us/azure/event-grid/pull-delivery-overview

    ps.: Please mark it as an accepted answer if the answer helped you.

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Gowtham CP 3,575 Reputation points
    2024-05-30T05:27:09.3933333+00:00

    Hello Philip Leung ,

    Thanks for reaching out in the Microsoft Q&A!

    Currently, Azure Functions does not have a built-in pull trigger for Event Grid Namespaces. Here are your options:

    • Utilize the existing Event Grid Trigger with a webhook (push model). This approach allows your function to receive notifications as soon as events are published. For more details, refer to the Microsoft Documentation.
    • Alternatively, create Event Hubs and set up a pull subscription on the Namespace Topic. Then, use the Event Hub Trigger in your function for a pull-based approach. Detailed guidance can be found in the Event Hubs Triggers documentation.

    If you find this helpful, please accept this answer to close the thread. Thanks!

    1 person found this answer helpful.
    0 comments No comments

  2. James Huber 0 Reputation points
    2024-05-30T06:14:39.8333333+00:00

    Hello, @Philip Leung my spotify pie

    If Azure Functions do not support direct triggering from Event Grid Namespace Topics with the pull model, the recommended approach is to use Azure Logic Apps or Azure Event Grid to bridge the gap. Here’s a concise outline of the steps:

    Event Grid Subscription to Logic App:

    Create an Event Grid subscription that forwards events from the Namespace Topic to an Azure Logic App.

    Configure the Logic App to receive and process these events.

    Logic App to Azure Function:

    Within the Logic App, define an HTTP trigger that calls the Azure Function.

    The Azure Function can then handle the business logic as needed.

    I hope this information will help you.

    Thanks! Best Regard.
    James Huber