Skip to content

Commit 278c5a0

Browse files
committed
Topics & Subscriptions quickstart
1 parent fc623e8 commit 278c5a0

File tree

8 files changed

+50
-39
lines changed

8 files changed

+50
-39
lines changed

articles/service-bus-messaging/includes/service-bus-create-queue-portal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
author: spelluru
55
ms.service: azure-service-bus
66
ms.topic: include
7-
ms.date: 12/11/2024
7+
ms.date: 01/16/2025
88
ms.author: spelluru
99
ms.custom: include file
1010
---

articles/service-bus-messaging/includes/service-bus-create-topic-subscription-portal.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
author: spelluru
55
ms.service: azure-service-bus
66
ms.topic: include
7-
ms.date: 10/11/2021
7+
ms.date: 01/16/2025
88
ms.author: spelluru
99
ms.custom: include file
1010
---
@@ -15,18 +15,17 @@
1515
4. Enter a **name** for the topic. Leave the other options with their default values.
1616
5. Select **Create**.
1717

18-
:::image type="content" source="./media/service-bus-create-topics-subscriptions-portal/create-topic.png" alt-text="Image showing the Create topic page.":::
18+
:::image type="content" source="./media/service-bus-create-topics-subscriptions-portal/create-topic.png" alt-text="Screenshot tthat shows the Create topic page in the Azure portal.":::
1919

2020
## Create a subscription to the topic
2121
1. Select the **topic** that you created in the previous section.
2222

23-
:::image type="content" source="./media/service-bus-create-topics-subscriptions-portal/select-topic.png" alt-text="Image showing the selection of topic from the list of topics.":::
23+
:::image type="content" source="./media/service-bus-create-topics-subscriptions-portal/select-topic.png" alt-text="Screenshot that shows the selection of topic from the list of topics.":::
2424
2. On the **Service Bus Topic** page, select **+ Subscription** on the toolbar.
2525

26-
:::image type="content" source="./media/service-bus-create-topics-subscriptions-portal/add-subscription-button.png" alt-text="Image showing the Add subscription button.":::
26+
:::image type="content" source="./media/service-bus-create-topics-subscriptions-portal/add-subscription-button.png" alt-text="Screenshot that shows the Add subscription button on the Topic page.":::
2727
3. On the **Create subscription** page, follow these steps:
2828
1. Enter **S1** for **name** of the subscription.
29-
1. Enter **3** for **Max delivery count**.
3029
1. Then, select **Create** to create the subscription.
3130

32-
:::image type="content" source="./media/service-bus-create-topics-subscriptions-portal/create-subscription-page.png" alt-text="Image showing the Create subscription page.":::
31+
:::image type="content" source="./media/service-bus-create-topics-subscriptions-portal/create-subscription-page.png" alt-text="Screenshot that shows the Create subscription page.":::
-7.27 KB
Loading
29.1 KB
Loading
Loading
-2.38 KB
Loading

articles/service-bus-messaging/service-bus-dotnet-get-started-with-queues.md

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,39 @@ ms.tgt_pltfrm: dotnet
66
ms.date: 01/16/2025
77
ms.devlang: csharp
88
ms.custom: mode-api, passwordless-dotnet, devx-track-dotnet
9+
# Customer intent: I want to learn how to send messages to an Azure Service Bus queue and receive messages from it.
910
---
1011

1112
# Quickstart: Send and receive messages from an Azure Service Bus queue (.NET)
1213

13-
In this quickstart, you'll do the following steps:
14+
In this quickstart, you do the following steps:
1415

1516
1. Create a Service Bus namespace, using the Azure portal.
1617
2. Create a Service Bus queue, using the Azure portal.
1718
3. Write a .NET console application to send a set of messages to the queue.
1819
4. Write a .NET console application to receive those messages from the queue.
1920

20-
> [!NOTE]
21-
> This quick start provides step-by-step instructions to implement a simple scenario of sending a batch of messages to a Service Bus queue and then receiving them. For an overview of the .NET client library, see [Azure Service Bus client library for .NET](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/servicebus/Azure.Messaging.ServiceBus/README.md). For more samples, see [Service Bus .NET samples on GitHub](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/servicebus/Azure.Messaging.ServiceBus/samples).
21+
This quick start provides step-by-step instructions to implement a simple scenario of sending a batch of messages to a Service Bus queue and then receiving them. For an overview of the .NET client library, see [Azure Service Bus client library for .NET](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/servicebus/Azure.Messaging.ServiceBus/README.md). For more samples, see [Service Bus .NET samples on GitHub](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/servicebus/Azure.Messaging.ServiceBus/samples).
2222

2323
## Prerequisites
2424

2525
If you're new to the service, see [Service Bus overview](service-bus-messaging-overview.md) before you do this quickstart.
2626

2727
- **Azure subscription**. To use Azure services, including Azure Service Bus, you need a subscription. If you don't have an existing Azure account, you can sign up for a [free trial](https://azure.microsoft.com/free/dotnet).
28-
- **Visual Studio 2022**. The sample application makes use of new features that were introduced in C# 10. You can still use the Service Bus client library with previous C# language versions, but the syntax might vary. To use the latest syntax, we recommend that you install .NET 6.0, or higher and set the language version to `latest`. If you're using Visual Studio, versions before Visual Studio 2022 aren't compatible with the tools needed to build C# 10 projects.
28+
- **Visual Studio 2022**. The sample application makes use of new features that were introduced in C# 10. You can still use the Service Bus client library with previous C# language versions, but the syntax might vary. To use the latest syntax, we recommend that you install .NET 6.0, or higher and set the language version to `latest`. If you're using Visual Studio, versions before Visual Studio 2022 aren't compatible with the tools needed to build C# 10 projects.
2929

3030
[!INCLUDE [service-bus-create-namespace-portal](./includes/service-bus-create-namespace-portal.md)]
3131

3232
[!INCLUDE [service-bus-create-queue-portal](./includes/service-bus-create-queue-portal.md)]
3333

3434
> [!IMPORTANT]
35-
> If you are new to Azure, you might find the **Connection String** option easier to follow. Select the **Connection String** tab to see instructions on using a connection string in this quickstart. We recommend that you use the **Passwordless** option in real-world applications and production environments.
35+
> If you're new to Azure, you might find the **Connection String** option easier to follow. Select the **Connection String** tab to see instructions on using a connection string in this quickstart. We recommend that you use the **Passwordless** option in real-world applications and production environments.
3636
3737
[!INCLUDE [service-bus-passwordless-template-tabbed](../../includes/passwordless/service-bus/service-bus-passwordless-template-tabbed.md)]
3838

39-
## Launch Visual Studio and sign-in to Azure
39+
## Launch Visual Studio
40+
41+
### [Passwordless](#tab/passwordless)
4042

4143
You can authorize access to the service bus namespace using the following steps:
4244

@@ -49,6 +51,10 @@ You can authorize access to the service bus namespace using the following steps:
4951

5052
:::image type="content" source="..//storage/blobs/media/storage-quickstart-blobs-dotnet/sign-in-visual-studio-account-small.png" alt-text="Screenshot showing the account selection.":::
5153

54+
### [Connection String](#tab/connection-string)
55+
Launch Visual Studio. If you see the **Get started** window, select the **Continue without code** link in the right pane.
56+
57+
---
5258

5359
## Send messages to the queue
5460

@@ -260,7 +266,7 @@ This section shows you how to create a .NET console application to send messages
260266
```
261267
262268
> [!IMPORTANT]
263-
> In most cases, it will take a minute or two for the role assignment to propagate in Azure. In rare cases, it might take up to **eight minutes**. If you receive authentication errors when you first run your code, wait a few moments and try again.
269+
> In most cases, it takes a minute or two for the role assignment to propagate in Azure. In rare cases, it might take up to **eight minutes**. If you receive authentication errors when you first run your code, wait a few moments and try again.
264270
8. In the Azure portal, follow these steps:
265271
1. Navigate to your Service Bus namespace.
266272
1. On the **Overview** page, select the queue in the bottom-middle pane.
@@ -676,12 +682,8 @@ In this section, you add code to retrieve messages from the queue.
676682
- In the **Messages** chart in the bottom **Metrics** section, you can see that there are three incoming messages and three outgoing messages for the queue.
677683
678684
:::image type="content" source="./media/service-bus-dotnet-get-started-with-queues/queue-messages-size-final.png" alt-text="Screenshot showing active messages and size after receive." lightbox="./media/service-bus-dotnet-get-started-with-queues/queue-messages-size-final.png":::
679-
680-
## Clean up resources
681685
682-
Navigate to your Service Bus namespace in the Azure portal, and select **Delete** on the Azure portal to delete the namespace and the queue in it.
683-
684-
## See also
686+
## Additional information
685687
686688
See the following documentation and samples:
687689
@@ -690,7 +692,10 @@ See the following documentation and samples:
690692
- [.NET API reference](/dotnet/api/azure.messaging.servicebus)
691693
- [Abstract away infrastructure concerns with higher-level frameworks like NServiceBus](./build-message-driven-apps-nservicebus.md)
692694
693-
## Next steps
695+
## Clean up resources
696+
697+
Navigate to your Service Bus namespace in the Azure portal, and select **Delete** on the Azure portal to delete the namespace and the queue in it.
698+
699+
## Related content
700+
See [Get started with Azure Service Bus topics and subscriptions (.NET)](service-bus-dotnet-how-to-use-topics-subscriptions.md).
694701
695-
> [!div class="nextstepaction"]
696-
> [Get started with Azure Service Bus topics and subscriptions (.NET)](service-bus-dotnet-how-to-use-topics-subscriptions.md)

articles/service-bus-messaging/service-bus-dotnet-how-to-use-topics-subscriptions.md

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,14 @@ ms.tgt_pltfrm: dotnet
66
ms.date: 01/16/2025
77
ms.devlang: csharp
88
ms.custom: mode-api, passwordless-dotnet, devx-track-dotnet
9+
# Customer intent: I want to learn how to send messages to an Azure Service Bus topic and receive messages from a subscription to the topic.
910
---
1011

11-
# Get started with Azure Service Bus topics and subscriptions (.NET)
12-
13-
> [!div class="op_single_selector" title1="Select the programming language:"]
14-
> * [C#](service-bus-dotnet-how-to-use-topics-subscriptions.md)
15-
> * [Java](service-bus-java-how-to-use-topics-subscriptions.md)
16-
> * [JavaScript](service-bus-nodejs-how-to-use-topics-subscriptions.md)
17-
> * [Python](service-bus-python-how-to-use-topics-subscriptions.md)
18-
12+
# Quickstart: Get started with Azure Service Bus topics and subscriptions (.NET)
1913

2014
This quickstart shows how to send messages to a Service Bus topic and receive messages from a subscription to that topic by using the [Azure.Messaging.ServiceBus](https://www.nuget.org/packages/Azure.Messaging.ServiceBus/) .NET library.
2115

22-
In this quickstart, you'll do the following steps:
16+
In this quickstart, you do the following steps:
2317

2418
1. Create a Service Bus namespace, using the Azure portal.
2519
2. Create a Service Bus topic, using the Azure portal.
@@ -28,8 +22,8 @@ In this quickstart, you'll do the following steps:
2822
5. Write a .NET console application to receive those messages from the subscription.
2923

3024
> [!NOTE]
31-
> This quick start provides step-by-step instructions to implement a simple scenario of sending a batch of messages to a Service Bus topic and receiving those messages from a subscription of the topic. For more samples on other and advanced scenarios, see [Service Bus .NET samples on GitHub](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/servicebus/Azure.Messaging.ServiceBus/samples).
32-
> - This quick start shows you two ways of connecting to Azure Service Bus: **connection string** and **passwordless**. The first option shows you how to use a connection string to connect to a Service Bus namespace. The second option shows you how to use your security principal in Microsoft Entra ID and the role-based access control (RBAC) to connect to a Service Bus namespace. You don't need to worry about having hard-coded connection string in your code or in a configuration file or in secure storage like Azure Key Vault. If you are new to Azure, you might find the connection string option easier to follow. We recommend using the passwordless option in real-world applications and production environments. For more information, see [Authentication and authorization](service-bus-authentication-and-authorization.md).
25+
> This quick start provides step-by-step instructions to implement a simple scenario of sending a batch of messages to a Service Bus topic and receiving those messages from a subscription of the topic. For more samples on other and advanced scenarios, see [Service Bus .NET samples on GitHub](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/servicebus/Azure.Messaging.ServiceBus/samples).
26+
> - This quick start shows you two ways of connecting to Azure Service Bus: **connection string** and **passwordless**. The first option shows you how to use a connection string to connect to a Service Bus namespace. The second option shows you how to use your security principal in Microsoft Entra ID and the role-based access control (RBAC) to connect to a Service Bus namespace. You don't need to worry about having hard-coded connection string in your code or in a configuration file or in secure storage like Azure Key Vault. If you're new to Azure, you might find the connection string option easier to follow. We recommend using the passwordless option in real-world applications and production environments. For more information, see [Authentication and authorization](service-bus-authentication-and-authorization.md).
3327
3428
## Prerequisites
3529

@@ -44,23 +38,32 @@ If you're new to the service, see [Service Bus overview](service-bus-messaging-o
4438

4539
[!INCLUDE [service-bus-passwordless-template-tabbed](../../includes/passwordless/service-bus/service-bus-passwordless-template-tabbed.md)]
4640

47-
## Launch Visual Studio and sign-in to Azure
41+
## Launch Visual Studio
42+
43+
### [Passwordless](#tab/passwordless)
4844

4945
You can authorize access to the service bus namespace using the following steps:
5046

5147
1. Launch Visual Studio. If you see the **Get started** window, select the **Continue without code** link in the right pane.
5248
1. Select the **Sign in** button in the top right of Visual Studio.
5349

54-
:::image type="content" source="./media/service-bus-dotnet-get-started-with-queues/azure-sign-button-visual-studio.png" alt-text="Screenshot showing the button to sign in to Azure using Visual Studio.":::
50+
:::image type="content" source="./media/service-bus-dotnet-get-started-with-queues/azure-sign-button-visual-studio.png" alt-text="Screenshot showing a button to sign in to Azure using Visual Studio.":::
51+
5552
1. Sign-in using the Microsoft Entra account you assigned a role to previously.
5653

5754
:::image type="content" source="..//storage/blobs/media/storage-quickstart-blobs-dotnet/sign-in-visual-studio-account-small.png" alt-text="Screenshot showing the account selection.":::
5855

56+
### [Connection String](#tab/connection-string)
57+
Launch Visual Studio. If you see the **Get started** window, select the **Continue without code** link in the right pane.
58+
59+
---
60+
61+
5962
## Send messages to the topic
6063
This section shows you how to create a .NET console application to send messages to a Service Bus topic.
6164

6265
> [!NOTE]
63-
> This quick start provides step-by-step instructions to implement a simple scenario of sending a batch of messages to a Service Bus topic and receiving those messages from a subscription of the topic. For more samples on other and advanced scenarios, see [Service Bus .NET samples on GitHub](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/servicebus/Azure.Messaging.ServiceBus/samples).
66+
> This quick start provides step-by-step instructions to implement a simple scenario of sending a batch of messages to a Service Bus topic and receiving those messages from a subscription of the topic. For more samples on other and advanced scenarios, see [Service Bus .NET samples on GitHub](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/servicebus/Azure.Messaging.ServiceBus/samples).
6467
6568
### Create a console application
6669

@@ -244,7 +247,7 @@ This section shows you how to create a .NET console application to send messages
244247
```
245248
246249
> [!IMPORTANT]
247-
> In most cases, it will take a minute or two for the role assignment to propagate in Azure. In rare cases, it might take up to **eight minutes**. If you receive authentication errors when you first run your code, wait a few moments and try again.
250+
> In most cases, it takes a minute or two for the role assignment to propagate in Azure. In rare cases, it might take up to **eight minutes**. If you receive authentication errors when you first run your code, wait a few moments and try again.
248251
1. In the Azure portal, follow these steps:
249252
1. Navigate to your Service Bus namespace.
250253
1. On the **Overview** page, in the bottom-middle pane, switch to the **Topics** tab, and select the Service Bus topic. In the following example, it's `mytopic`.
@@ -261,7 +264,7 @@ This section shows you how to create a .NET console application to send messages
261264
In this section, you create a .NET console application that receives messages from the subscription to the Service Bus topic.
262265
263266
> [!NOTE]
264-
> This quick start provides step-by-step instructions to implement a simple scenario of sending a batch of messages to a Service Bus topic and receiving those messages from a subscription of the topic. For more samples on other and advanced scenarios, see [Service Bus .NET samples on GitHub](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/servicebus/Azure.Messaging.ServiceBus/samples).
267+
> This quick start provides step-by-step instructions to implement a simple scenario of sending a batch of messages to a Service Bus topic and receiving those messages from a subscription of the topic. For more samples on other and advanced scenarios, see [Service Bus .NET samples on GitHub](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/servicebus/Azure.Messaging.ServiceBus/samples).
265268
266269
### Create a project for the receiver
267270
@@ -307,6 +310,7 @@ In this section, you add code to retrieve messages from the subscription.
307310
1. Replace the existing contents of `Program.cs` with the following properties and methods:
308311
309312
313+
310314
## [Passwordless](#tab/passwordless)
311315
312316
```csharp
@@ -341,6 +345,9 @@ In this section, you add code to retrieve messages from the subscription.
341345
342346
## [Connection String](#tab/connection-string)
343347
348+
> [!IMPORTANT]
349+
> Update placeholder values (`<TOPIC-SUBSCRIPTION-NAME>`) in the code snippet with names of the topic and the subscription.
350+
344351
```csharp
345352
using System.Threading.Tasks;
346353
using Azure.Messaging.ServiceBus;
@@ -654,7 +661,7 @@ In this section, you add code to retrieve messages from the subscription.
654661
655662
656663
657-
## Next steps
664+
## Related content
658665
See the following documentation and samples:
659666
660667
- [Azure Service Bus client library for .NET - Readme](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/servicebus/Azure.Messaging.ServiceBus)

0 commit comments

Comments
 (0)