-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make actor responses optional by default, added ConsistentHash/RoundR…
…obin reply routers
- Loading branch information
1 parent
727a739
commit e8463dd
Showing
23 changed files
with
394 additions
and
82 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
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,42 @@ | ||
| ||
namespace Nixie.Tests.Actors; | ||
|
||
public sealed class RouterResponse | ||
{ | ||
public string Data { get; } | ||
|
||
public RouterResponse(string data) | ||
{ | ||
Data = data; | ||
} | ||
} | ||
|
||
public sealed class RouteeReplyActor : IActor<RouterMessage, RouterResponse> | ||
{ | ||
private int receivedMessages; | ||
|
||
private readonly IActorContext<RouteeReplyActor, RouterMessage, RouterResponse> context; | ||
|
||
public RouteeReplyActor(IActorContext<RouteeReplyActor, RouterMessage, RouterResponse> context) | ||
{ | ||
this.context = context; | ||
} | ||
|
||
public int GetMessages() | ||
{ | ||
return receivedMessages; | ||
} | ||
|
||
public void IncrMessage() | ||
{ | ||
receivedMessages++; | ||
} | ||
|
||
public Task<RouterResponse?> Receive(RouterMessage message) | ||
{ | ||
if (message.Type == RouterMessageType.Route) | ||
IncrMessage(); | ||
|
||
return Task.FromResult<RouterResponse?>(new RouterResponse(message.Data)); | ||
} | ||
} |
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
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
Oops, something went wrong.