Skip to content

Commit 9a1d4ff

Browse files
Merge pull request #208913 from spelluru/sbusqs0823
Set transport type to web sockets
2 parents 138e705 + f1f662d commit 9a1d4ff

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

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

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,11 @@ This section shows you how to create a .NET Core console application to send mes
115115
// of the application, which is best practice when messages are being published or read
116116
// regularly.
117117
//
118-
// Create the clients that we'll use for sending and processing messages.
119-
client = new ServiceBusClient(connectionString);
118+
// set the transport type to AmqpWebSockets so that the ServiceBusClient uses the port 443.
119+
// If you use the default AmqpTcp, you will need to make sure that the ports 5671 and 5672 are open
120+
121+
var clientOptions = new ServiceBusClientOptions() { TransportType = ServiceBusTransportType.AmqpWebSockets };
122+
client = new ServiceBusClient(connectionString, clientOptions);
120123
sender = client.CreateSender(queueName);
121124
122125
// create a batch
@@ -182,8 +185,11 @@ This section shows you how to create a .NET Core console application to send mes
182185
// of the application, which is best practice when messages are being published or read
183186
// regularly.
184187
//
185-
// Create the clients that we'll use for sending and processing messages.
186-
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);
187193
sender = client.CreateSender(queueName);
188194
189195
// create a batch
@@ -329,10 +335,12 @@ In this section, you'll add code to retrieve messages from the queue.
329335
// of the application, which is best practice when messages are being published or read
330336
// regularly.
331337
//
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
332340
333-
// Create the client object that will be used to create sender and receiver objects
334-
client = new ServiceBusClient(connectionString);
335-
341+
var clientOptions = new ServiceBusClientOptions() { TransportType = ServiceBusTransportType.AmqpWebSockets };
342+
client = new ServiceBusClient(connectionString, clientOptions);
343+
336344
// create a processor that we can use to process the messages
337345
processor = client.CreateProcessor(queueName, new ServiceBusProcessorOptions());
338346
@@ -411,9 +419,11 @@ In this section, you'll add code to retrieve messages from the queue.
411419
// of the application, which is best practice when messages are being published or read
412420
// regularly.
413421
//
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
414424
415-
// Create the client object that will be used to create sender and receiver objects
416-
client = new ServiceBusClient(connectionString);
425+
var clientOptions = new ServiceBusClientOptions() { TransportType = ServiceBusTransportType.AmqpWebSockets };
426+
client = new ServiceBusClient(connectionString, clientOptions);
417427
418428
// create a processor that we can use to process the messages
419429
processor = client.CreateProcessor(queueName, new ServiceBusProcessorOptions());

0 commit comments

Comments
 (0)