放置令牌失败。状态代码:404 - Azure 函数 (Java) 无法被服务总线触发
Put token failed. status-code: 404 - Azure Function (Java) fails get triggered by Service Bus
我尝试使用 VS Code 创建基于 Java 的简单 Azure Functions。
我尝试从服务总线获取主题消息。
//local.settings.json(SAS 策略:RadioTopicPolicy = Manage/Read/Listen)
"topicconnstring":"Endpoint=sb://111standardsb.servicebus.windows.net/;SharedAccessKeyName=RadioTopicPolicy;SharedAccessKey
=11111nuAmrb16c3/cGaxe0dYGTz/tiBebTI+peG4zE=;"
此函数由服务总线主题触发并将数据存储到数据湖
binding example
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.
此错误表示自动转发目标实体的目标不存在。目标实体(队列或主题)必须在源创建之前存在。创建目标实体后重试。
看看这个文档:
我注意到你说
There is "Radio" Service Bus Topic and "RadioSubscription"
Subscription in Azure Service Bus. There is "RadioTopicPolicy"
所以你的函数应该是这样的:
@FunctionName("TopicTriggerDataLakeOutput")
public void run(
@ServiceBusTopicTrigger(
name = "message",
topicName = "Radio",
subscriptionName = "RadioSubscription",
connection = "topicconnstring"
) String message,
final ExecutionContext context
) {
context.getLogger().info(message);
}
并确保您的 SAS 令牌的主键正确。希望对您有所帮助。:)
我尝试使用 VS Code 创建基于 Java 的简单 Azure Functions。 我尝试从服务总线获取主题消息。
//local.settings.json(SAS 策略:RadioTopicPolicy = Manage/Read/Listen)
"topicconnstring":"Endpoint=sb://111standardsb.servicebus.windows.net/;SharedAccessKeyName=RadioTopicPolicy;SharedAccessKey
=11111nuAmrb16c3/cGaxe0dYGTz/tiBebTI+peG4zE=;"
此函数由服务总线主题触发并将数据存储到数据湖 binding example
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.
此错误表示自动转发目标实体的目标不存在。目标实体(队列或主题)必须在源创建之前存在。创建目标实体后重试。
看看这个文档:
我注意到你说
There is "Radio" Service Bus Topic and "RadioSubscription" Subscription in Azure Service Bus. There is "RadioTopicPolicy"
所以你的函数应该是这样的:
@FunctionName("TopicTriggerDataLakeOutput")
public void run(
@ServiceBusTopicTrigger(
name = "message",
topicName = "Radio",
subscriptionName = "RadioSubscription",
connection = "topicconnstring"
) String message,
final ExecutionContext context
) {
context.getLogger().info(message);
}
并确保您的 SAS 令牌的主键正确。希望对您有所帮助。:)