Azure功能,灵活的测试和生产队列名称 [英] Azure function, flexible test and production queue names

查看:95
本文介绍了Azure功能,灵活的测试和生产队列名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设计Azure Function托管以实现灵活的测试/生产队列隔离?

How can I design my Azure Function hosting for flexible test/production queue isolation?

我计划以C#形式编写6个预编译的Azure函数,这些函数打包为单个DLL,并且尚未决定是否将使用WebJobSdk函数注释或多个.json配置文件.我的6个Azure函数将仅具有输入绑定,并且所有这些都将通过存储队列触发.

I am planning to write 6 precompiled Azure Functions in C# packaged as single DLL and have yet to to decide if I will use WebJobSdk function annotation or multiple .json config files. My 6 Azure functions will only have input bindings and all will be triggered via storage queues.

我不喜欢在源代码中将队列名称硬编码为方法属性字符串的想法,但我知道INameResolver提供了命名间接性.

I dislike the idea of hardcoding queue names in source code as method attribute strings but I understand that INameResolver provides for naming indirection.

这是测试/生产存储队列绑定隔离的标准解决方案,还是某些其他形式的更高级别的Azure环境声明可以用零代码实现相同的目的?

Is this the standard solution for test/production storage queue binding isolation or can some other form of higher level Azure environment declaration achieve the same with zero code?

推荐答案

您提到的方法,您依靠INameResolver功能根据环境设置这些队列名称肯定会起作用,并为您提供更多帮助与在预编译程序集中将队列名称定义为文字的队列相比,它具有更大的灵活性.如果维护环境和编写代码的团队不同,则这一点尤其重要.

The approach you've mentioned, where you rely on the INameResolver functionality to set those queue names based on the environment would definitely work and give you a more flexibility than if you had those queue names defined as literals in your pre-compiled assemblies. This is particularly important if the teams maintaining the environment and writing the code are different.

值得注意的是,尽管单独使用上述方法是可行的,但为了更好地隔离并避免其他潜在问题,我们建议在开发/测试和运行生产工作负载时使用完全不同的存储帐户. 在这种情况下,您仍然可以利用INameResolver行为来增加灵活性.

It's worth noting that, although the approach above alone would work, our recommendation, for better isolation, and to avoid other potential issues, would be to use completely different storage accounts when developing/testing and when running your production workloads. You can still leverage the INameResolver behavior for added flexibility in this case.

这篇关于Azure功能,灵活的测试和生产队列名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆