Skip to content

Commit f1f662d

Browse files
committed
ServiceBusClient
1 parent c06ca87 commit f1f662d

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,11 @@ This section shows you how to create a .NET Core console application to send mes
185185
// of the application, which is best practice when messages are being published or read
186186
// regularly.
187187
//
188-
// Create the clients that we'll use for sending and processing messages.
189-
client = new ServiceBusClient(connectionString);
188+
// set the transport type to AmqpWebSockets so that the ServiceBusClient uses the port 443.
189+
// If you use the default AmqpTcp, you will need to make sure that the ports 5671 and 5672 are open
190+
191+
var clientOptions = new ServiceBusClientOptions() { TransportType = ServiceBusTransportType.AmqpWebSockets };
192+
client = new ServiceBusClient(connectionString, clientOptions);
190193
sender = client.CreateSender(queueName);
191194
192195
// create a batch
@@ -332,10 +335,12 @@ In this section, you'll add code to retrieve messages from the queue.
332335
// of the application, which is best practice when messages are being published or read
333336
// regularly.
334337
//
338+
// set the transport type to AmqpWebSockets so that the ServiceBusClient uses the port 443.
339+
// If you use the default AmqpTcp, you will need to make sure that the ports 5671 and 5672 are open
335340
336-
// Create the client object that will be used to create sender and receiver objects
337-
client = new ServiceBusClient(connectionString);
338-
341+
var clientOptions = new ServiceBusClientOptions() { TransportType = ServiceBusTransportType.AmqpWebSockets };
342+
client = new ServiceBusClient(connectionString, clientOptions);
343+
339344
// create a processor that we can use to process the messages
340345
processor = client.CreateProcessor(queueName, new ServiceBusProcessorOptions());
341346
@@ -414,9 +419,11 @@ In this section, you'll add code to retrieve messages from the queue.
414419
// of the application, which is best practice when messages are being published or read
415420
// regularly.
416421
//
422+
// set the transport type to AmqpWebSockets so that the ServiceBusClient uses the port 443.
423+
// If you use the default AmqpTcp, you will need to make sure that the ports 5671 and 5672 are open
417424
418-
// Create the client object that will be used to create sender and receiver objects
419-
client = new ServiceBusClient(connectionString);
425+
var clientOptions = new ServiceBusClientOptions() { TransportType = ServiceBusTransportType.AmqpWebSockets };
426+
client = new ServiceBusClient(connectionString, clientOptions);
420427
421428
// create a processor that we can use to process the messages
422429
processor = client.CreateProcessor(queueName, new ServiceBusProcessorOptions());

0 commit comments

Comments
 (0)