-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
bbf982f
commit aa1b737
Showing
8 changed files
with
40 additions
and
37 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
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
public class GenericHandler(ManualResetEvent @event) : | ||
IHandleMessages<StartGenericHandler<string>> | ||
{ | ||
public Task Handle(StartGenericHandler<string> message, HandlerContext context) | ||
public async Task Handle(StartGenericHandler<string> message, HandlerContext context) | ||
{ | ||
await Task.Delay(1100, context.CancellationToken); | ||
context.LogInformation("Hello from {@Handler}."); | ||
@event.Set(); | ||
return Task.CompletedTask; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
public class TheHandlerThatLogs(ManualResetEvent @event) : | ||
IHandleMessages<StartHandlerThatLogs> | ||
{ | ||
public Task Handle(StartHandlerThatLogs message, HandlerContext context) | ||
public async Task Handle(StartHandlerThatLogs message, HandlerContext context) | ||
{ | ||
await Task.Delay(1100, context.CancellationToken); | ||
var logger = LogManager.GetLogger<TheHandlerThatThrows>(); | ||
logger.Error("The message", new()); | ||
@event.Set(); | ||
return Task.CompletedTask; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
public class TheHandlerThatThrows : | ||
IHandleMessages<StartHandlerThatThrows> | ||
{ | ||
public Task Handle(StartHandlerThatThrows message, HandlerContext context) => | ||
public async Task Handle(StartHandlerThatThrows message, HandlerContext context) | ||
{ | ||
await Task.Delay(1100, context.CancellationToken); | ||
throw new(); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
src/Tests/HandlerUsingContextLogger/HandlerUsingContextLogger.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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
public class HandlerUsingContextLogger : | ||
IHandleMessages<StartHandlerUsingContextLogger> | ||
{ | ||
public Task Handle(StartHandlerUsingContextLogger message, HandlerContext context) | ||
public async Task Handle(StartHandlerUsingContextLogger message, HandlerContext context) | ||
{ | ||
await Task.Delay(1100, context.CancellationToken); | ||
context.LogError("The message", new Exception()); | ||
return Task.CompletedTask; | ||
} | ||
} |
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