-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Singleton class and settings based on current Akka Typed implementation #6050
Singleton class and settings based on current Akka Typed implementation #6050
Conversation
This looks great @ismaelhamed - I'll review this shortly. |
The only thing I've found with this implementation is that if the user already have a |
0cf3f2f
to
dd5e0ef
Compare
Added some test and documentation. |
b5fc70c
to
3e461d3
Compare
What would an end-user need to do to work around that? Is there something we'll have to document or help them migrate with? |
I would probably only recommend using this newer API for brand new applications since, at the very least, a cluster restart is needed. IMO, if you already have your singletons figured out, this will only save you a few lines of code which may not be worth the effort. |
3e461d3
to
589d69c
Compare
so this will only affect users who are using the singleton path as the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - greatly simplifies the API for managing ClusterSingleton
s. This is a major usability improvement.
|
||
Any `Actor` can be run as a singleton. E.g. a basic counter: | ||
|
||
```csharp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally, we prefer to use DocFx's [code]
blocks that reference a runnable source file instead of traditional markdown blocks - see https://getakka.net/community/contributing/documentation-guidelines.html#code-samples-must-use-code-references for examples on how to do this.
Reason why we care: if the sample is updated, the documentation is also automatically updated too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to merge this in now and we can update those docs to reference your unit tests' code in a separate PR.
} | ||
|
||
[Fact] | ||
public void A_cluster_singleton_must_be_accessible_from_two_nodes_in_a_cluster() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
} | ||
catch (InvalidActorNameException ex) when (ex.Message.EndsWith("is not unique!")) | ||
{ | ||
// This is fine. We just wanted to make sure it is running and it already is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #6036
Changes
Since this already exists in Akka Typed and it isn't built on top of anything Akka-Typed specific, I put together a quick port with this functionality:
singletonName
on this node, no additional manager is started.singletonName
on this node, an IActorRef to that is returned.Usage
This will required a complete cluster restart though, since the names for both the
ClusterSingletonManager
andClusterSingletonManagerProxy
are now automatically constructed (i.e., based on the code above, the new manager will be namedsingletonManagerGlobalCounter
and the proxysingletonProxyGlobalCounter
).Checklist
For significant changes, please ensure that the following have been completed (delete if not relevant):
ShardRegion
s? #6036