exam questions

Exam AZ-203 All Questions

View all questions & answers for the AZ-203 exam

Exam AZ-203 topic 6 question 6 discussion

Actual exam question from Microsoft's AZ-203
Question #: 6
Topic #: 6
[All AZ-203 Questions]

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?

  • A. await subscriptionClient.CloseAsync();
  • B. await subscriptionClient.AddRuleAsync(new RuleDescription(RuleDescription.DefaultRuleName, new TrueFilter()));
  • C. subscriptionClient.RegisterMessageHandler(ProcessMessagesAsync, messageHandlerOptions);
  • D. subscriptionClient = new SubscriptionClient(ServiceBusConnectionString, TopicName, SubscriptionName);
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️
Using topic client, call RegisterMessageHandler which is used to receive messages continuously from the entity. It registers a message handler and begins a new thread to receive messages. This handler is waited on every time a new message is received by the receiver. subscriptionClient.RegisterMessageHandler(ReceiveMessagesAsync, messageHandlerOptions);
References:
https://www.c-sharpcorner.com/article/azure-service-bus-topic-and-subscription-pub-sub/

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
user30
Highly Voted 5 years, 1 month ago
actually should be option A if its CompleteAsync() and not CloseAsync(), which removes method from the queue. The answer mentioned is correct...
upvoted 8 times
altafpatel1984
3 years, 6 months ago
Complete/Close cannot prevent receiving messages.
upvoted 1 times
...
...
rrongcheng
Highly Voted 4 years, 10 months ago
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
upvoted 8 times
...
altafpatel1984
Most Recent 3 years, 6 months ago
For consuming messages, registermessagehandler is must. So Answer C is absolutely correct.
upvoted 1 times
...
user30
5 years, 1 month ago
should be option A
upvoted 1 times
altafpatel1984
3 years, 6 months ago
Complete/Close cannot prevent receiving messages.
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...