-
-
Notifications
You must be signed in to change notification settings - Fork 517
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
703bdbe
commit cf425a4
Showing
10 changed files
with
58 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
Workshops/EventDrivenArchitecture/05-Consistency/Core/TimeoutException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace Consistency.Core; | ||
|
||
public class TimeoutException(string message): Exception(message); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
Workshops/EventDrivenArchitecture/Solutions/05-Consistency/Core/TimeoutException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
namespace Consistency.Core; | ||
|
||
public class TimeoutException(string message): Exception(message); |
22 changes: 22 additions & 0 deletions
22
.../EventDrivenArchitecture/Solutions/05-Consistency/Sagas/Version1-Aggregates/Core/Retry.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Polly; | ||
using Polly.Retry; | ||
|
||
namespace Consistency.Sagas.Version1_Aggregates.Core; | ||
|
||
public class Retry | ||
{ | ||
public static int RetriesCount; | ||
|
||
private static readonly AsyncRetryPolicy retryPolicy = Policy | ||
.Handle<TimeoutException>() | ||
.WaitAndRetryForeverAsync( | ||
(_, _) => | ||
{ | ||
RetriesCount++; | ||
|
||
return TimeSpan.FromMilliseconds(1); | ||
}); | ||
|
||
public Task UntilSucceeds(Func<CancellationToken, ValueTask> handle, CancellationToken token = default) => | ||
retryPolicy.ExecuteAsync(async ct => await handle(ct), token); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters