You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Note down the connection string to the namespace, the queue name. You'll use them later in this tutorial.
45
+
45
46
## Send messages to the queue
46
47
47
48
This section shows you how to create a .NET console application to send messages to a Service Bus queue.
@@ -81,7 +82,7 @@ This section shows you how to create a .NET console application to send messages
81
82
### [Connection string](#tab/connection-string)
82
83
83
84
> [!IMPORTANT]
84
-
> Per the `TODO` comment, update the placeholder values in the code snippets with the values from the Service Bus you created.
85
+
> Update placeholder values (`<NAMESPACE-CONNECTION-STRING>` and `<QUEUE-NAME>`) in the code snippet with actual values you noted down earlier.
85
86
86
87
* Creates a [ServiceBusClient](/dotnet/api/azure.messaging.servicebus.servicebusclient) object using the connection string.
87
88
* Invokes the [CreateSender](/dotnet/api/azure.messaging.servicebus.servicebusclient.createsender) method on the [ServiceBusClient](/dotnet/api/azure.messaging.servicebus.servicebusclient) object to create a [ServiceBusSender](/dotnet/api/azure.messaging.servicebus.servicebussender) object for the specific Service Bus queue.
> Note down the connection string to the namespace, the topic name, and the subscription name. You'll use them later in this tutorial.
55
54
56
55
## Send messages to the topic
57
56
This section shows you how to create a .NET console application to send messages to a Service Bus topic.
@@ -90,6 +89,9 @@ This section shows you how to create a .NET console application to send messages
90
89
91
90
## [Connection String](#tab/connection-string)
92
91
92
+
> [!IMPORTANT]
93
+
> Update placeholder values (`<NAMESPACE-CONNECTION-STRING>` and `<TOPIC-NAME>`) in the code snippet with actual values you noted down earlier.
94
+
93
95
1. Creates a [ServiceBusClient](/dotnet/api/azure.messaging.servicebus.servicebusclient) object using the connection string to the namespace.
94
96
1. Invokes the [CreateSender](/dotnet/api/azure.messaging.servicebus.servicebusclient.createsender) method on the `ServiceBusClient` object to create a [ServiceBusSender](/dotnet/api/azure.messaging.servicebus.servicebussender) object for the specific Service Bus topic.
95
97
1. Creates a [ServiceBusMessageBatch](/dotnet/api/azure.messaging.servicebus.servicebusmessagebatch) object by using the [ServiceBusSender.CreateMessageBatchAsync](/dotnet/api/azure.messaging.servicebus.servicebussender.createmessagebatchasync).
@@ -346,6 +348,9 @@ In this section, you'll add code to retrieve messages from the subscription.
346
348
347
349
## [Connection String](#tab/connection-string)
348
350
351
+
> [!IMPORTANT]
352
+
> Update placeholder values (`<NAMESPACE-CONNECTION-STRING>`, `<TOPIC-NAME>`, `<SUBSCRIPTION-NAME>`) in the code snippet with actual values you noted down earlier.
353
+
349
354
* Creates a [ServiceBusClient](/dotnet/api/azure.messaging.servicebus.servicebusclient) object using the connection string to the namespace.
350
355
* Invokes the [CreateProcessor](/dotnet/api/azure.messaging.servicebus.servicebusclient.createprocessor) method on the `ServiceBusClient` object to create a [ServiceBusProcessor](/dotnet/api/azure.messaging.servicebus.servicebusprocessor) object for the specified Service Bus topic.
351
356
* Specifies handlers for the [ProcessMessageAsync](/dotnet/api/azure.messaging.servicebus.servicebusprocessor.processmessageasync) and [ProcessErrorAsync](/dotnet/api/azure.messaging.servicebus.servicebusprocessor.processerrorasync) events of the `ServiceBusProcessor` object.
@@ -360,8 +365,8 @@ In this section, you'll add code to retrieve messages from the subscription.
360
365
// regularly.
361
366
//
362
367
// Create the clients that we'll use for sending and processing messages.
363
-
// TODO: Replace the <CONNECTION-STRING-VALUE> placeholder
364
-
client = new ServiceBusClient("<CONNECTION-STRING-VALUE>">);
368
+
// TODO: Replace the <NAMESPACE-CONNECTION-STRING> placeholder
369
+
client = new ServiceBusClient("<NAMESPACE-CONNECTION-STRING>">);
365
370
366
371
// create a processor that we can use to process the messages
367
372
// TODO: Replace the <TOPIC-NAME> and <SUBSCRIPTION-NAME> placeholders
@@ -487,8 +492,8 @@ In this section, you'll add code to retrieve messages from the subscription.
487
492
// regularly.
488
493
//
489
494
// Create the clients that we'll use for sending and processing messages.
490
-
// TODO: Replace the <CONNECTION-STRING-VALUE> placeholder
491
-
client = new ServiceBusClient("<CONNECTION-STRING-VALUE>">);
495
+
// TODO: Replace the <NAMESPACE-CONNECTION-STRING> placeholder
496
+
client = new ServiceBusClient("<NAMESPACE-CONNECTION-STRING>">);
492
497
493
498
// create a processor that we can use to process the messages
494
499
// TODO: Replace the <TOPIC-NAME> and <SUBSCRIPTION-NAME> placeholders
0 commit comments