I have set of Azure functions with QueueTrigger triggers on them. The goal is to support another cloud platform (e.g KafkaTrigger) depending on the configuration or at least as a build pipeline step.
Approaches I have come up with:
I haven't found to achieve this, and even if I had, the underlying QueueTrigger objects are primarily internal.
Probably would work, but I am trying to find a better solution.
Again, doesn't seem like a good approach. Will require either a code generation for Disable attribute or some hack logic.
Question:
Is there a better way to achieve this? Maybe creating a custom trigger is a viable option and I am missing something?
You can disable a function via app settings.
The recommended way to disable a function is with an app setting in the format
AzureWebJobs.<FUNCTION_NAME>.Disabled
set to true.
So with common code extracted out and two differently triggered functions, you can simply update app settings to activate the function that you want.
Considering the simplicity here, I don't believe the other solutions are worth the effort unless you want to integrate the functionality of disabling/enabling functions via another system automatically. Even then, you are likely better off to extract the automation into another function app.