Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Put token failed. status-code: 404 - Azure Function (Java) fails get triggered by Service Bus

I try to create simple Java based Azure Functions with VS Code. I try to get Topic message from Service Bus.

//local.settings.json (SAS Policy: RadioTopicPolicy = Manage/Read/Listen)

"topicconnstring":"Endpoint=sb://111standardsb.servicebus.windows.net/;SharedAccessKeyName=RadioTopicPolicy;SharedAccessKey 
       =11111nuAmrb16c3/cGaxe0dYGTz/tiBebTI+peG4zE=;"

This Function get triggered by Service Bus Topic and store data to Data Lake 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);
    }

}

Errors when debugging in 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.
like image 993
Kenny_I Avatar asked Oct 14 '25 11:10

Kenny_I


1 Answers

This error means the destination for the autoforwarding destination entity doesn't exist. The destination entity (queue or topic), must exist before the source is created. Retry after creating the destination entity.

Have a look of this doc:

https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-resource-manager-exceptions#error-bad-request

I notice that you say

There is "Radio" Service Bus Topic and "RadioSubscription" Subscription in Azure Service Bus. There is "RadioTopicPolicy"

So your function should be like this:

@FunctionName("TopicTriggerDataLakeOutput")
    public void run(
        @ServiceBusTopicTrigger(
            name = "message",
            topicName = "Radio",
            subscriptionName = "RadioSubscription",
            connection = "topicconnstring"
        ) String message,
        final ExecutionContext context
    ) {
        context.getLogger().info(message);
    }

And make sure the primary key of your SAS token is correct. Hope it helps.:)

like image 100
Cindy Pau Avatar answered Oct 17 '25 01:10

Cindy Pau



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!