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
Copy file name to clipboardExpand all lines: samples/errorhandling/sample.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Automatic Retries
3
3
summary: Shows immediate and delayed retries when a handler throws an exception.
4
-
reviewed: 2023-09-15
4
+
reviewed: 2025-08-04
5
5
component: Core
6
6
related:
7
7
- nservicebus/recoverability
@@ -13,26 +13,26 @@ This sample shows the different ways that NServiceBus [recoverability features](
13
13
14
14
Run the sample **without debugging**.
15
15
16
-
The message handler in both endpoints is set to throw an exception, causing the handled message to end up in the error queue. The portable Particular Service Platform will list the messages arriving in the error queue.
16
+
The message handler in both endpoints (`WithoutDelayedRetries` and `WithDelayedRetries`) is set to throw an exception, causing the handled message to end up in the error queue. The portable Particular Service Platform will list the messages arriving in the error queue.
17
17
18
18
snippet: handler
19
19
20
-
The "With Delayed Retries" endpoint uses the standard Delayed Retries settings.
20
+
The `WithDelayedRetries` endpoint uses the standard Delayed Retries settings.
21
21
22
-
The "Disable Delayed Retries" endpoint disables Delayed Retries with the following:
22
+
The `WithoutDelayedRetries` endpoint disables Delayed Retries with the following:
23
23
24
24
snippet: Disable
25
25
26
26
## The output
27
27
28
28
> [!WARNING]
29
-
> This sample uses `Console.Writeline` instead of standard logging only for brevity and should not be used in production code.
29
+
> This sample uses `Console.WriteLine` instead of standard logging only for brevity and should not be used in production code.
30
30
31
31
### Without Delayed Retries
32
32
33
33
In this endpoint, the message is retried successively without any delay and then, after the final failure, it is forwarded to the configured error queue.
34
34
35
-
```
35
+
```bash
36
36
Handling MyMessage with MessageId:b5d0ea24-63c7-4729-8fd3-a6dc0161a7f8
37
37
Handling MyMessage with MessageId:b5d0ea24-63c7-4729-8fd3-a6dc0161a7f8
38
38
Handling MyMessage with MessageId:b5d0ea24-63c7-4729-8fd3-a6dc0161a7f8
@@ -45,9 +45,9 @@ System.Exception: An exception occurred in the handler.
45
45
46
46
### With Delayed Retries
47
47
48
-
In this endpoint, the message is tried successively first and then delayed for the configured amount of time and then retried again. After the final configured retry, the message is moved to the error queue. The sample displays the retry number for clarity.
48
+
In this endpoint, the message is first [retried immediately](/nservicebus/recoverability/#immediate-retries), then retried again after a [configured delay](/nservicebus/recoverability/configure-delayed-retries.md). After the final configured retry, the message is moved to the error queue. The sample displays the retry number for clarity.
49
49
50
-
```
50
+
```bash
51
51
This is retry number 1
52
52
Handling MyMessage with MessageId:05b97154-04b9-405a-92d7-a6dc0163273f
53
53
Handling MyMessage with MessageId:05b97154-04b9-405a-92d7-a6dc0163273f
0 commit comments