Exam-Answer

== Trim, Convert and Download YouTube videos at cutyt.com. Free! ==

Home / Microsoft / AZ-300 / Question 120

Prev Question
Next Question

Question 120

You manage an ecommerce site that is hosted in Azure App Service. You need to use Azure to allow multiple applications to be notified whenever a new order is placed.

How should you complete the code? Select correct placeholder values.

static async Task SendMessage(string connectionString, string entityPath, byte[] message)

{

var client = new PLACEHOLDER 1(connectionString, entityPath);

await client.SendAsync(PLACEHOLDER 2);

}

Answers



A B C D

Advertisement

Explanation

You should use the following code:

static async Task SendMessage(string connectionString, string entityPath, byte[] message)

{

var client = new TopicClient(connectionString, entityPath);

await client.SendAsync(new Message(message));

}

This code creates an instance of TopicClient, which allows you to send messages to a Service Bus topic. A Service Bus topic allows client subscriptions, which allows multiple applications to receive messages that are sent to the topic. The SendAsync method accepts a Message instance, which represents the message being sent.

You should not create an instance of QueueClient. This class represents a Service Bus queue, which allows only one client to retrieve a message. Once the message is retrieved, it is removed from the queue.

You should not pass a byte as a parameter to the SendAsync method. You must wrap the byte in a Message instance.

References

Comments

Load more
Prev Question
Next Question


== Trim, Convert and Download YouTube videos at cutyt.com. Free! ==