简体   繁体   English

如何使用 Java SDK 从我的远程 Azure 应用程序配置中检索服务总线队列的队列名称?

[英]How can I retrieve the queue name for a service bus queue from my remote Azure App Configuration using the Java SDK?

The function app I'm working on works perfectly when setting my config using a local.settings.json file.当使用 local.settings.json 文件设置我的配置时,我正在开发的 function 应用程序完美运行。 I have set up a new App Configuration in Azure to manage the properties remotely but I have been getting the following error on startup:我已经在 Azure 中设置了一个新的 App Configuration 来远程管理属性,但是我在启动时遇到了以下错误:

[2022-04-01T14:34:07.209Z] The 'QueueTrigger' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.QueueTrigger'. Microsoft.Azure.WebJobs.Host: '%QueueName%' does not resolve to a value.

I'm picking up the correct connection string value without any issues but it appears that the queueName property of the @ServiceBusQueueTrigger is not detecting the queue name variable I have set in the azure config.我正在毫无问题地获取正确的连接字符串值,但似乎 @ServiceBusQueueTrigger 的 queueName 属性没有检测到我在 azure 配置中设置的队列名称变量。

@FunctionName("QueueTrigger")
public void serviceBusProcess(
        @ServiceBusQueueTrigger(
            name = "message", 
            queueName = "%QueueName%", 
            connection = "QueueConnectionString"
        ) String message, final ExecutionContext context) {

    // process message

}

Is there a way to insert this variable without having to hard-code the value?有没有办法插入这个变量而不必对值进行硬编码?

Speaking from a .NET perspective, I haven't found a solution until today than hardcoding the value.从 .NET 的角度来看,直到今天我还没有找到比硬编码值更好的解决方案。 I guess it is required by the runtime to bind to the queue to the trigger.我想运行时需要将队列绑定到触发器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 逻辑应用中的 Azure 服务总线队列错误 - Azure service bus queue error in the logic app 如何使用 Azure CLI 在逻辑应用程序工作流中连接服务总线队列? - How to connect Service bus queue in a logic app workflow using Azure CLI? 队列名称未绑定到 azure 服务总线(Azure 逻辑应用程序) - Queue Name is not binding to azure service bus (Azure Logic Apps) 如何使用 spring 引导 java 应用程序从服务总线队列中持续拉取消息 - How to continuously pull messages from service bus queue by using spring boot java application 如何在 ASP.NET MVC web 应用程序的 View.cshtml 中从 Azure 服务总线(队列)获取消息 - How to get messages from Azure Service Bus (Queue) in View.cshtml in ASP.NET MVC web app 无法使用托管身份将消息从 Azure API 发布到 Azure 服务总线队列 - Unable to post message to Azure Service Bus Queue from Azure API using Managed Identity Azure 服务总线 - 使用 HTTP 调用将消息从订阅复制到队列 - Azure service bus - Copying messages from subscription to a queue using HTTP call 如何根据消息属性筛选 Azure 服务总线队列消息? - how do I filter Azure Service Bus Queue messages based on a message property? Azure 服务总线队列自动删除,如 RabbitMQ - Azure Service Bus queue autodelete like in RabbitMQ 清除 azure 服务总线队列 go - Clearing azure service bus queue in one go
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM