Skip to content
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

Preparations before Akka.Cluster.Tools and Akka.Cluster.Sharding packaging #1591

Merged
merged 2 commits into from
Jan 4, 2016

Conversation

Horusiath
Copy link
Contributor

Motivation

First PR of Akka.Cluster.Tools and Akka.Cluster.Sharding introduced two fresh modules. However they were missing some parts, like lack of API encapsulation. Purpose of this PR is to prepare them for nightly releases.

Modifications

  • Added nuspec files for Akka.Cluster.Tools and Akka.Cluster.Sharding and included those assemblies in build.fsx.
  • Implemented proto-buf based serializer for Akka.Cluster.Sharding messages.
  • Moved cluster sharding and cluster tools control messages out of class nesting. Now they reside directly in correlated namespaces.
  • Added async API for retrieving ShardRegion and ShardRegionProxy from ClusterSharding extension.
  • Marked message definitions used by plugins internally as internal instead of public.
  • Reorganized Cluster sharding example to be more readable.
  • Renamed "entry" to "entity" in xml-docs (as they should be called by current convention).

Result

Enclosed some of the API to reduce noise generated by types and prevent accidental missuse. Changed control message to follow C# namespacing convention. Improved contol messages serialization.

var settings = ClusterShardingSettings.Create(_system).WithRole(role);
var startMsg = new ClusterShardingGuardian.StartProxy(typeName, settings, idExtractor, shardResolver);
var started = await _guardian.Value.Ask<ClusterShardingGuardian.Started>(startMsg, timeout);
_regions.TryAdd(typeName, started.ShardRegion);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if two calls to StartProxyAsync is called?
The current TryAdd will only add the first and drop the 2nd on the floor.
Is that the intended behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't necessarily matters, as this asynchronous async call will return the same actor ref (see ClusterShardingGuardian handler).

Aaronontheweb added a commit that referenced this pull request Jan 4, 2016
Preparations before Akka.Cluster.Tools and Akka.Cluster.Sharding packaging
@Aaronontheweb Aaronontheweb merged commit 02cf74d into akkadotnet:dev Jan 4, 2016
@Horusiath Horusiath deleted the akka-cluster-sharding-wip branch March 23, 2016 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants