Share via

Runtime subscription model with Azure Functions

Andy Durrans 0 Reputation points
2023-11-20T11:07:14.0466667+00:00

I would like an Azure Function to be able to subscribe to certain events with a custom filter at runtime. Think of it like this: a separate HTTP trigger results in the function needing to subscribe to future events for a given customer ID only.

What is the best way of achieving this? I have complete freedom over the event infrastructure.

  • I like the look of Azure Web PubSub, but I don't see a way of adding the function's PubSub connection to a group at runtime to only receive messages from a group only.
  • I could just subscribe to all PubSub events then filter the events as the first step of the function, but that would mean a tonne of wasted invocations.
  • I could use Event Grid and create a subscription at runtime, but that feels wrong as it means the function would need to know about itself (i.e. where EventGrid should send events to), and also the limit of 500 subscriptions per topic would become an issue as things scale.

Or am I misusing what Azure Functions are meant for and I should have some other infrastructure doing this instead?

This seems like a simple ask, so either I'm missing something, or there's a solution available that I haven't seen.

Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.


1 answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

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