예제 #1
0
            /// <summary>
            /// TBD
            /// </summary>
            /// <param name="typeName">TBD</param>
            /// <param name="settings">TBD</param>
            /// <param name="extractEntityId">TBD</param>
            /// <param name="extractShardId">TBD</param>
            /// <exception cref="ArgumentException">
            /// This exception is thrown when the specified <paramref name="typeName"/> is undefined.
            /// </exception>
            public StartProxy(string typeName, ClusterShardingSettings settings, ExtractEntityId extractEntityId, ExtractShardId extractShardId)
            {
                if (string.IsNullOrEmpty(typeName))
                {
                    throw new ArgumentNullException(nameof(typeName), "ClusterSharding start proxy requires type name to be provided");
                }

                TypeName        = typeName;
                Settings        = settings;
                ExtractEntityId = extractEntityId;
                ExtractShardId  = extractShardId;
            }
예제 #2
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="typeName">TBD</param>
        /// <param name="entityProps">TBD</param>
        /// <param name="settings">TBD</param>
        /// <param name="coordinatorPath">TBD</param>
        /// <param name="extractEntityId">TBD</param>
        /// <param name="extractShardId">TBD</param>
        /// <param name="handOffStopMessage">TBD</param>
        /// <param name="replicator"></param>
        /// <param name="majorityMinCap"></param>
        public ShardRegion(string typeName, Func <string, Props> entityProps, ClusterShardingSettings settings, string coordinatorPath, ExtractEntityId extractEntityId, ExtractShardId extractShardId, object handOffStopMessage, IActorRef replicator, int majorityMinCap)
        {
            TypeName           = typeName;
            EntityProps        = entityProps;
            Settings           = settings;
            CoordinatorPath    = coordinatorPath;
            ExtractEntityId    = extractEntityId;
            ExtractShardId     = extractShardId;
            HandOffStopMessage = handOffStopMessage;
            _replicator        = replicator;
            _majorityMinCap    = majorityMinCap;

            _retryTask = Context.System.Scheduler.ScheduleTellRepeatedlyCancelable(Settings.TunningParameters.RetryInterval, Settings.TunningParameters.RetryInterval, Self, Retry.Instance, Self);
            SetupCoordinatedShutdown();
        }
예제 #3
0
 /// <summary>
 /// Factory method for the <see cref="Actor.Props"/> of the <see cref="ShardRegion"/> actor.
 /// </summary>
 /// <param name="typeName">TBD</param>
 /// <param name="entityProps">TBD</param>
 /// <param name="settings">TBD</param>
 /// <param name="coordinatorPath">TBD</param>
 /// <param name="extractEntityId">TBD</param>
 /// <param name="extractShardId">TBD</param>
 /// <param name="handOffStopMessage">TBD</param>
 /// <param name="replicator"></param>
 /// <param name="majorityMinCap"></param>
 /// <returns>TBD</returns>
 internal static Props Props(string typeName, Func <string, Props> entityProps, ClusterShardingSettings settings, string coordinatorPath, ExtractEntityId extractEntityId, ExtractShardId extractShardId, object handOffStopMessage, IActorRef replicator, int majorityMinCap)
 {
     return(Actor.Props.Create(() => new ShardRegion(typeName, entityProps, settings, coordinatorPath, extractEntityId, extractShardId, handOffStopMessage, replicator, majorityMinCap)).WithDeploy(Deploy.Local));
 }
예제 #4
0
 /// <summary>
 /// Factory method for the <see cref="Actor.Props"/> of the <see cref="ShardRegion"/> actor when used in proxy only mode.
 /// </summary>
 /// <param name="typeName">TBD</param>
 /// <param name="settings">TBD</param>
 /// <param name="coordinatorPath">TBD</param>
 /// <param name="extractEntityId">TBD</param>
 /// <param name="extractShardId">TBD</param>
 /// <param name="replicator"></param>
 /// <param name="majorityMinCap"></param>
 /// <returns>TBD</returns>
 internal static Props ProxyProps(string typeName, ClusterShardingSettings settings, string coordinatorPath, ExtractEntityId extractEntityId, ExtractShardId extractShardId, IActorRef replicator, int majorityMinCap)
 {
     return(Actor.Props.Create(() => new ShardRegion(typeName, null, settings, coordinatorPath, extractEntityId, extractShardId, PoisonPill.Instance, replicator, majorityMinCap)).WithDeploy(Deploy.Local));
 }
예제 #5
0
        public static Props Props(string typeName, ShardId shardId, Props entityProps, ClusterShardingSettings settings, ExtractEntityId extractEntityId, ExtractShardId extractShardId, object handOffStopMessage, IActorRef replicator, int majorityMinCap)
        {
            switch (settings.StateStoreMode)
            {
            case StateStoreMode.Persistence when settings.RememberEntities:
                return(Actor.Props.Create(() => new PersistentShard(typeName, shardId, entityProps, settings, extractEntityId, extractShardId, handOffStopMessage)).WithDeploy(Deploy.Local));

            case StateStoreMode.DData when settings.RememberEntities:
                return(Actor.Props.Create(() => new DDataShard(typeName, shardId, entityProps, settings, extractEntityId, extractShardId, handOffStopMessage, replicator, majorityMinCap)).WithDeploy(Deploy.Local));

            default:
                return(Actor.Props.Create(() => new Shard(typeName, shardId, entityProps, settings, extractEntityId, extractShardId, handOffStopMessage)).WithDeploy(Deploy.Local));
            }
        }