Receive messages from the queue
- Create a new console application and add a reference to the Service Bus NuGet package, similar to the sending application above.
- Add the following using statement to the top of the Program.cs file.
- Add the following code to the Main method, set the connectionString variable as the connection string that was obtained when creating the namespace, and set queueName as the queue name that you used when creating the queue.
- Here is what your Program.cs file should look like:
- Run the program, and check the portal. Notice that the Queue Length value should now be 0.
- Queue length
Congratulations! You have now created a queue, sent a message, and received a message.