question

RobCollie-6002 avatar image
0 Votes"
RobCollie-6002 asked MayankBargali-MSFT commented

Azure Function using a topic trigger: The messaging entity could not be found.

I have a test function that simply gets triggered by a message to a topic:

     [FunctionName("TestFunction")]
     public static void Run([ServiceBusTrigger("test", "%Subscription%", Connection = "ServiceBusConnectionString")]string myQueueItem, ILogger log)
     {
         log.LogInformation($"C# ServiceBus queue trigger function processed message: {myQueueItem}");
     }

When running the function in Azure, I get (with project names hidden):

2021-08-11T07:03:58.094 [Error] Message processing error (Action=Receive, ClientId=MessageReceiver4test/Subscriptions/<removed>, EntityPath=test/Subscriptions/<removed>, Endpoint=<removed>.servicebus.windows.net)Microsoft.Azure.ServiceBus.MessagingEntityNotFoundException : The messaging entity '<removed>:Topic:test|<removed>' could not be found.

I've literally done this with a copy-and-pasted subscription name, topic name and service bus connection string.

122208-temp.png



Are there some extra steps I need to take?

azure-functionsdotnet-runtimeazure-service-bus
temp.png (1.4 KiB)
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@RobCollie-6002 The error is expected if the entity is not found and I was able to reproduce the issue if the entity name (namespace name, topic name or subscription name is incorrect ). Can you confirm if you are not using the entity connection string? Please test it with namespace connection string.
In you above code I can see that you are using subscription parameter as %Subscription%. If you are running it in your local machine your local.settings.json should have this parameter define with the value as your subscription name. Can you share more details on my private comment.

122266-image.png

0 Votes 0 ·
image.png (6.6 KiB)

I'm running it in Azure portal at the moment.

Am I OK to share the details here?

0 Votes 0 ·

@RobCollie-6002 Please don't share your subscription ID or any PI information here. But you can share the service bus name and other details requested only in my private comment. If you are running in azure then please share the function app name only in private comment.

0 Votes 0 ·

1 Answer

MayankBargali-MSFT avatar image
0 Votes"
MayankBargali-MSFT answered

@RobCollie-6002 Thanks for sharing more details. As we can see that there was no subscription under the topic the error message is expected behavior. You need to create a new subscription and configure the same in your function app.
To learn more on topic and subscription please refer to this document.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.