AZ-203 Exam QuestionsBrowse all questions from this exam

AZ-203 Exam - Question 73


A company is implementing a publish-subscribe (Pub/Sub) messaging component by using Azure Service Bus. You are developing the first subscription application.

In the Azure portal you see that messages are being sent to the subscription for each topic. You create and initialize a subscription client object by supplying the correct details, but the subscription application is still not consuming the messages.

You need to complete the source code of the subscription client

What should you do?

Show Answer
Correct Answer: C

The code to receive messages must include setting up a message handler. The subscriptionClient.RegisterMessageHandler method is used to register a message handler and to continuously begin a new thread to receive messages, thus enabling the application to consume messages from the subscription. This ensures that any incoming message to the subscription is processed by the defined handler asynchronously.

Discussion

4 comments
Sign in to comment
user30
Apr 30, 2020

actually should be option A if its CompleteAsync() and not CloseAsync(), which removes method from the queue. The answer mentioned is correct...

altafpatel1984
Nov 21, 2021

Complete/Close cannot prevent receiving messages.

rrongcheng
Jul 23, 2020

The given answer is correct: C - subscriptionClient.RegisterMessageHandler https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-dotnet-how-to-use-topics-subscriptions

user30
Apr 30, 2020

should be option A

altafpatel1984
Nov 21, 2021

Complete/Close cannot prevent receiving messages.

altafpatel1984
Nov 20, 2021

For consuming messages, registermessagehandler is must. So Answer C is absolutely correct.