Skip to content

Commit 1704ae7

Browse files
committed
Update
1 parent 94db1d4 commit 1704ae7

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

articles/service-bus-messaging/message-transfers-locks-settlement.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ If the application produces bursts of messages, illustrated here with a plain lo
3434
With an assumed 70-millisecond Transmission Control Protocol (TCP) roundtrip latency distance from an on-premises site to Service Bus and giving just 10 ms for Service Bus to accept and store each message, the following loop takes up at least 8 seconds, not counting payload transfer time or potential route congestion effects:
3535

3636
```csharp
37-
for (int i = 0; i < 100; i++)
37+
for (int i = 0; i < 10; i++)
3838
{
39-
// creating the message omitted for brevity
40-
await client.SendAsync(…);
39+
// creating the message omitted for brevity
40+
await sender.SendMessageAsync(message);
4141
}
4242
```
4343

@@ -47,9 +47,9 @@ With the same assumptions as for the prior loop, the total overlapped execution
4747

4848
```csharp
4949
var tasks = new List<Task>();
50-
for (int i = 0; i < 100; i++)
50+
for (int i = 0; i < 10; i++)
5151
{
52-
tasks.Add(client.SendAsync(…));
52+
tasks.Add(sender.SendMessageAsync(message));
5353
}
5454
await Task.WhenAll(tasks);
5555
```
@@ -62,26 +62,25 @@ Semaphores, as shown in the following code snippet in C#, are synchronization ob
6262
var semaphore = new SemaphoreSlim(10);
6363

6464
var tasks = new List<Task>();
65-
for (int i = 0; i < 100; i++)
65+
for (int i = 0; i < 10; i++)
6666
{
67-
await semaphore.WaitAsync();
67+
await semaphore.WaitAsync();
6868

69-
tasks.Add(client.SendAsync(…).ContinueWith((t)=>semaphore.Release()));
69+
tasks.Add(sender.SendMessageAsync(message).ContinueWith((t)=>semaphore.Release()));
7070
}
7171
await Task.WhenAll(tasks);
7272
```
7373

7474
Applications should **never** initiate an asynchronous send operation in a "fire and forget" manner without retrieving the outcome of the operation. Doing so can load the internal and invisible task queue up to memory exhaustion, and prevent the application from detecting send errors:
7575

7676
```csharp
77-
for (int i = 0; i < 100; i++)
77+
for (int i = 0; i < 10; i++)
7878
{
79-
80-
client.SendAsync(message); // DON’T DO THIS
79+
sender.SendMessageAsync(message); // DON’T DO THIS
8180
}
8281
```
8382

84-
With a low-level AMQP client, Service Bus also accepts "pre-settled" transfers. A pre-settled transfer is a fire-and-forget operation for which the outcome, either way, isn't reported back to the client and the message is considered settled when sent. The lack of feedback to the client also means that there's no actionable data available for diagnostics, which means that this mode doesn't qualify for help via Azure support.
83+
With a low-level AMQP client, Service Bus also accepts "presettled" transfers. A presettled transfer is a fire-and-forget operation for which the outcome, either way, isn't reported back to the client and the message is considered settled when sent. The lack of feedback to the client also means that there's no actionable data available for diagnostics, which means that this mode doesn't qualify for help via Azure support.
8584

8685
## Settling receive operations
8786

0 commit comments

Comments
 (0)