[英]Is MessageReceiver supported in Service Bus Topic Triggered Java Azure Function?
[英]Put token failed. status-code: 404 - Azure Function (Java) fails get triggered by Service Bus
我嘗試使用 VS 代碼創建基於 Azure 的簡單 Java 函數。 我嘗試從服務總線獲取主題消息。
//local.settings.json(SAS 策略:RadioTopicPolicy = Manage/Read/Listen)
"topicconnstring":"Endpoint=sb://111standardsb.servicebus.windows.net/;SharedAccessKeyName=RadioTopicPolicy;SharedAccessKey
=11111nuAmrb16c3/cGaxe0dYGTz/tiBebTI+peG4zE=;"
此 Function 由服務總線主題觸發並將數據存儲到數據湖綁定示例
package com.function;
import com.microsoft.azure.functions.annotation.*;
import com.microsoft.azure.functions.*;
/**
* Azure Functions with Azure Storage Queue trigger.
*/
public class TopicTriggerCosmosOutput {
/**
* This function will be invoked when a new message is received at the specified path. The
message contents are provided as input to this function.
*/
@FunctionName("TopicTriggerDataLakeOutput")
public void run(
@ServiceBusTopicTrigger(
name = "message",
topicName = "radioTopic",
subscriptionName = "RadioSubscription",
connection = "topicconnstring"
) String message,
final ExecutionContext context
) {
context.getLogger().info(message);
}
}
在 VS Code 中調試時的錯誤:
[3.4.2020 12.29.30] Message processing error
(Action=Receive,
ClientId=MessageReceiver1radioTopic/Subscriptions/RadioSubscription,
EntityPath=radioTopic/Subscriptions/RadioSubscription, Endpoint=mystandardsb.servicebus.windows.net)
[3.4.2020 12.29.30] Microsoft.Azure.ServiceBus: Put token failed. status-code: 404, status-
description: The messaging entity
'sb://mystandardsb.servicebus.windows.net/radioTopic/Subscriptions/RadioSubscription' could not be
found. To know more visit
https://aka.ms/sbResourceMgrExceptions. TrackingId:67df5bb7-87fb-48ca-
9e8e-6829c4e3a4a1_G25,
SystemTracker:mystandardsb.servicebus.windows.net:radioTopic/Subscriptions/RadioSubscription,
Timestamp:2020-04-03T12:29:30.
此錯誤表示自動轉發目標實體的目標不存在。 目標實體(隊列或主題)必須在創建源之前存在。 創建目標實體后重試。
看看這個文檔:
我注意到你說
Azure Service Bus 中有“Radio”服務總線主題和“RadioSubscription”訂閱。 有“RadioTopicPolicy”
所以你的 function 應該是這樣的:
@FunctionName("TopicTriggerDataLakeOutput")
public void run(
@ServiceBusTopicTrigger(
name = "message",
topicName = "Radio",
subscriptionName = "RadioSubscription",
connection = "topicconnstring"
) String message,
final ExecutionContext context
) {
context.getLogger().info(message);
}
並確保您的 SAS 令牌的主鍵是正確的。 希望能幫助到你。:)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.