Skip to content

Commit 00ba116

Browse files
authored
Merge pull request #175256 from spelluru/sbusqueue1011
fixed issues
2 parents 6214d20 + 2e65b56 commit 00ba116

File tree

3 files changed

+32
-8
lines changed

3 files changed

+32
-8
lines changed

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ To create a namespace:
2323
1. For **Subscription**, choose an Azure subscription in which to create the namespace.
2424
1. For **Resource group**, choose an existing resource group in which the namespace will live, or create a new one.
2525
1. Enter a **name for the namespace**. The system immediately checks to see if the name is available. For a list of rules for naming namespaces, see [Create Namespace REST API](/rest/api/servicebus/create-namespace).
26-
1. For **Location**, choose the region in which your namespace should be hosted.1.
27-
1. For **Pricing tier**, select the pricing tier (Basic, Standard, or Premium) for the namespace. If you want to use [topics and subscriptions](../service-bus-queues-topics-subscriptions.md#topics-and-subscriptions), choose either Standard or Premium. Topics/subscriptions are not supported in the Basic pricing tier. If you selected the **Premium** pricing tier, specify the number of **messaging units**. The premium tier provides resource isolation at the CPU and memory level so that each workload runs in isolation. This resource container is called a messaging unit. A premium namespace has at least one messaging unit. You can select 1, 2, or 4 messaging units for each Service Bus Premium namespace. For more information, see [Service Bus Premium Messaging](../service-bus-premium-messaging.md).
28-
7. Select **Review + create**. The system now creates your namespace and enables it. You might have to wait several minutes as the system provisions resources for your account.
26+
1. For **Location**, choose the region in which your namespace should be hosted.
27+
1. For **Pricing tier**, select the pricing tier (Basic, Standard, or Premium) for the namespace. For this quickstart, select **Standard**.
28+
29+
If you want to use [topics and subscriptions](../service-bus-queues-topics-subscriptions.md#topics-and-subscriptions), choose either Standard or Premium. Topics/subscriptions aren't supported in the Basic pricing tier.
30+
31+
If you selected the **Premium** pricing tier, specify the number of **messaging units**. The premium tier provides resource isolation at the CPU and memory level so that each workload runs in isolation. This resource container is called a messaging unit. A premium namespace has at least one messaging unit. You can select 1, 2, or 4 messaging units for each Service Bus Premium namespace. For more information, see [Service Bus Premium Messaging](../service-bus-premium-messaging.md).
32+
1. Select **Review + create**. The system now creates your namespace and enables it. You might have to wait several minutes as the system provisions resources for your account.
2933

3034
:::image type="content" source="./media/service-bus-create-namespace-portal/create-namespace.png" alt-text="Image showing the Create a namespace page":::
3135
1. On the **Review + create** page, review settings, and select **Create**.
@@ -37,7 +41,9 @@ To create a namespace:
3741
:::image type="content" source="./media/service-bus-create-namespace-portal/service-bus-namespace-home-page.png" alt-text="Image showing the home page of the Service Bus namespace created." :::
3842

3943
## Get the connection string
40-
Creating a new namespace automatically generates an initial Shared Access Signature (SAS) rule with an associated pair of primary and secondary keys that each grant full control over all aspects of the namespace. See [Service Bus authentication and authorization](../service-bus-authentication-and-authorization.md) for information about how to create rules with more constrained rights for regular senders and receivers. To copy the primary and secondary keys for your namespace, follow these steps:
44+
Creating a new namespace automatically generates an initial Shared Access Signature (SAS) policy with primary and secondary keys, and primary and secondary connection strings that each grant full control over all aspects of the namespace. See [Service Bus authentication and authorization](../service-bus-authentication-and-authorization.md) for information about how to create rules with more constrained rights for regular senders and receivers.
45+
46+
To copy the primary connection string for your namespace, follow these steps:
4147

4248
1. On the **Service Bus Namespace** page, select **Shared access policies** on the left menu.
4349
3. On the **Shared access policies** page, select **RootManageSharedAccessKey**.
@@ -47,3 +53,4 @@ Creating a new namespace automatically generates an initial Shared Access Signat
4753

4854
:::image type="content" source="./media/service-bus-create-namespace-portal/connection-string.png" alt-text="Screenshot shows an S A S policy called RootManageSharedAccessKey, which includes keys and connection strings.":::
4955

56+
You can use this page to copy primary key, secondary key, and secondary connection string.
-4.19 KB
Loading

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

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ This section shows you how to create a .NET Core console application to send mes
6262
1. In **Program.cs**, add the following `using` statements at the top of the namespace definition, before the class declaration.
6363
6464
```csharp
65-
using System;
6665
using System.Threading.Tasks;
6766
using Azure.Messaging.ServiceBus;
6867
```
@@ -255,7 +254,6 @@ In this section, you'll add code to retrieve messages from the queue.
255254
1. In **Program.cs**, add the following `using` statements at the top of the namespace definition, before the class declaration.
256255
257256
```csharp
258-
using System;
259257
using System.Threading.Tasks;
260258
using Azure.Messaging.ServiceBus;
261259
```
@@ -270,14 +268,33 @@ In this section, you'll add code to retrieve messages from the queue.
270268
// name of your Service Bus queue
271269
static string queueName = "<QUEUE NAME>";
272270
273-
274271
// the client that owns the connection and can be used to create senders and receivers
275272
static ServiceBusClient client;
276273
277274
// the processor that reads and processes messages from the queue
278275
static ServiceBusProcessor processor;
279276
```
280-
3. Replace code in the `Main` method with the following code. See code comments for details about the code. Here are the important steps from the code. See code comments for more details.
277+
3. Add the following methods to the `Program` class to handle received messages and any errors.
278+
279+
```csharp
280+
// handle received messages
281+
static async Task MessageHandler(ProcessMessageEventArgs args)
282+
{
283+
string body = args.Message.Body.ToString();
284+
Console.WriteLine($"Received: {body}");
285+
286+
// complete the message. messages is deleted from the queue.
287+
await args.CompleteMessageAsync(args.Message);
288+
}
289+
290+
// handle any errors when receiving messages
291+
static Task ErrorHandler(ProcessErrorEventArgs args)
292+
{
293+
Console.WriteLine(args.Exception.ToString());
294+
return Task.CompletedTask;
295+
}
296+
```
297+
4. Replace code in the `Main` method with the following code. See code comments for details about the code. Here are the important steps from the code. See code comments for more details.
281298
Here are the important steps from the code:
282299
1. Creates a [ServiceBusClient](/dotnet/api/azure.messaging.servicebus.servicebusclient) object using the primary connection string to the namespace.
283300
1. Invokes the [CreateProcessor](/dotnet/api/azure.messaging.servicebus.servicebusclient.createprocessor) method on the [ServiceBusClient](/dotnet/api/azure.messaging.servicebus.servicebusclient) object to create a [ServiceBusProcessor](/dotnet/api/azure.messaging.servicebus.servicebusprocessor) object for the specified Service Bus queue.

0 commit comments

Comments
 (0)