java - How can we pass topic and subscription name from yaml in azure function - java
问题描述
@FunctionName("TestHandler")
public void Handler(
@ServiceBusTopicTrigger(
name = "ServiceBus",
topicName = "topicname",
connection = "ServiceBusConnectionString",
subscriptionName = "subscriptionName")
String message,
final ExecutionContext context) {}
I want to fetch subscriptionName value from deployment.yaml , config map settings. How can I get the value from there.
解决方案
不可能。
这是一个函数设置,只能在 中指定function.json
,如果 Java 是生成的,而不是由您编写的。所以它必须在代码中。
在某些例外情况下,您可以在代码中指定一个特殊值,它指的是应用程序设置(例如,请参阅 SheduleExpression以了解计时器触发器)。但我在服务总线绑定中看不到任何类似的东西。
您可以通过subscriptionName = "%MY_SUBSCRIPTION_CONFIG%"
在注释/代码中指定并添加MY_SUBSCRIPTION_CONFIG
到应用程序设置(通过local.settings.json
或其他方式)来尝试一下,看看它是否有效。
否则,请联系 Azure 支持以确认一种或另一种方式。
推荐阅读
- vue.js - validate iso date but display locale date when using a date picker component
- c++ - enable_if_t 中带有折叠表达式的编译器错误
- javascript - 如何异步切换按钮上的点击事件
- javascript - Cannot access array values using a variable in javascript
- c# - For 循环在完成后重复并返回 ArgumentOutOfRangeException
- keras - 在数据集上运行 keras model.predict 返回的精度与在同一数据集上的 model.evaluate 不同
- python - 从 Jupyter 笔记本中删除空目录错误
- c++14 - Merge Sort implementation outputs wrong results
- javascript - 在页面重新加载之前将错误消息保留更长时间
- xcodebuild - 使用 `xcodebuild` 为 Mac 的 Catalyst/UIKit 进行命令行构建?